HashiCorp Cloud Platform
Webhook events
This topic contains reference information about events that you can send in webhook payloads. HCP webhook payloads contain a set of fields that HCP Packer fills out with important information about a registry lifecycle event. Refer to Create and manage webhooks for additional information. For every event, HCP Packer provides the following information:
- Resource ID: The ID of your HCP Packer registry.
- Resource name: The resource name of your HCP Packer registry.
- Event ID: The unique identifier for the event generated by the services with the format
<service>.event:<random string>
. For example,packer.event:t79BRg8WhTmDPBRM
. - Event action: The type of action of this event. For example,
create
. - Event description: The event description. For example,
Created version
. - Event source: The source of the event. For example,
hashicorp.packer.version
. - Event version: The version of the event payload that is being sent.
- Event payload: The payload with the information about the event. Refer to the specific event payload documentation.
Refer to Create and manage webhooks for additional information.
Version events
HCP Packer sends webhook payloads for the following version events. The event description links to its payload reference.
Action | Description |
---|---|
create | Created version |
complete | Completed version |
revoke | Revoked version |
restore | Restored version |
delete | Deleted version |
schedule-revocation | Scheduled version revocation |
cancel-revocation | Cancelled version revocation |
assign | Assigned version to channel |
Common version events fields
Every version lifecycle event payload contains the following fields.
Field | Type | Description |
---|---|---|
organization_id | string | The HCP organization ID. |
project_id | string | The HCP Packer project ID. |
registry.id | string | The ID of the HCP Packer registry. |
bucket.id | string | The ID of the bucket. |
bucket.name | string | User-given name of the bucket. |
version.id | string | ID of the Version. |
version.fingerprint | string | User-given version identifier. |
version.name | string | Human-readable name of the version incrementally set when all builds are successful. |
version.revoke_at | timestamp | Date and time the version was revoked or is scheduled to be revoked. |
version.revocation_message | string | Message provided by the user when revoking the version or scheduling the version to be revoked. |
version.revocation_author | string | The actor who revoked the version or scheduled the version to be revoked. |
version.status | string | Current state of the version. Possible values: RUNNING , CANCELLED , REVOKED , REVOCATION_SCHEDULED , ACTIVE |
actor.principal_id | string | The ID of the actor. |
actor.type | string | The type of actor. This field returns "TYPE_UNSET", "TYPE_USER", "TYPE_SERVICE", "TYPE_INTERNAL_OPERATOR", or "TYPE_ANONYMOUS". |
actor.user.email | string | This field is present if the actor is "TYPE_USER". |
actor.user.name | string | This field is present if the actor is "TYPE_USER". |
actor.user.id | string | This field is present if the actor is "TYPE_USER". |
actor.service.id | string | This field is present if the actor is "TYPE_SERVICE". |
actor.service.name | string | This field is present if the actor is "TYPE_SERVICE". |
actor.service.user_managed | bool | This field is present if the actor is "TYPE_SERVICE". |
actor.internal_operator.id | string | This field is present if the actor is "TYPE_INTERNAL_OPERATOR". |
builds | array | List of builds built in the version. |
builds.id | string | ID of the build. |
builds.platform | string | Plaftorm of the build. For example, aws or azure . |
builds.component_type | string | Builder or post-processor used on the build. For example, amazon-ebs.ubuntu . |
builds.labels | json | Labels of the build. |
builds.artifacts | array | Artifacts built by the build. |
builds.artifacts.region | string | Region of the artifact. For example, eu-west-1 . |
builds.artifacts.external_identifier | string | External identifier of the artifact. For example, ami-13245456 . |
Example payload of a Completed version
event with the common fields to all events.
{
"resource_id": "01HAVMCV8XWW945TNKT2KPYSN1",
"resource_name": "packer/project/ff99bac7-eaec-40a1-8f55-5eb05e789401/registry/01HAVMCV8XWW945TNKT2KPYSN1",
"event_id": "packer.event:MtCpPwmkdPpD8qqfMRhJ",
"event_action": "complete",
"event_description": "Completed version",
"event_source": "hashicorp.packer.version",
"event_version": "1",
"event_payload": {
"actor": {
"principal_id": "ac7295a2-85ef-4594-b4c6-3a1f8b733f1a",
"type": "TYPE_USER",
"user": {
"email": "user@email.com",
"id": "d8f45791-460d-434e-8a40-f627e752276a",
"name": "User Name"
}
},
"bucket": {
"id": "01HAVMDEAXNF5RYDDSK5R39HDP",
"name": "test"
},
"version": {
"fingerprint": "01HAVMD1YBM4PA1KHNYFAYJREM",
"id": "01HAVMD63G58XDA8JKS2B8J871",
"revocation_author": "",
"revocation_message": "",
"revoke_at": "",
"status": "ACTIVE",
"name": "v1"
},
"builds":[
{
"platform":"aws",
"component_type":"amazon-ebs.ubuntu",
"id":"01H5APPBYYF4D0NMVZCRKR85E7",
"artifacts":[
{
"external_identifier":"ami-f2",
"region":"us-west-2"
}
],
"labels":{
"os":"ubuntu"
}
}
],
"organization_id": "6a171c1d-c7cd-4047-ba1a-92d686dde2ed",
"project_id": "ff99bac7-eaec-40a1-8f55-5eb05e789401",
"registry": {
"id": "01HAVMCV8XWW945TNKT2KPYSN1"
},
}
}
Created version
Action | Source | Description |
---|---|---|
create | hashicorp.packer.version | Created version |
HCP Packer delivers a webhook payload when a version is created.
The webhook event payload for Created version
contains the common fields with the exception of builds
. Version builds are created after the version is created.
Completed version
Action | Source | Description |
---|---|---|
complete | hashicorp.packer.version | Completed version |
HCP Packer delivers a webhook payload with the common fields when a version is completed.
Revoked version
Action | Source | Description |
---|---|---|
revoke | hashicorp.packer.version | Revoked version |
HCP Packer delivers a webhook payload when a version is revoked.
The following field is available in the webhook event payload next to the common fields.
Field | Type | Description |
---|---|---|
skip_descendants_revocation | bool | This field is true when the request for revoking skips revoking the version descendants. |
Restored version
Action | Source | Description |
---|---|---|
restore | hashicorp.packer.version | Restored version |
HCP Packer delivers a webhook payload with the common fields when a revoked version is restored.
Deleted version
Action | Source | Description |
---|---|---|
delete | hashicorp.packer.version | Deleted version |
HCP Packer delivers a webhook payload with the common fields when a revoked version is deleted.
Scheduled version revocation
Action | Source | Description |
---|---|---|
schedule-revocation | hashicorp.packer.version | Scheduled version revocation |
HCP Packer delivers a webhook payload when a version is scheduled to be revoked.
The following field is available in the webhook event payload next to the common fields.
Field | Type | Description |
---|---|---|
skip_descendants_revocation | bool | This field is true when the request for scheduling revocation skips schedule revocation for the version descendants. |
Cancelled version revocation
Action | Source | Description |
---|---|---|
cancel-revocation | hashicorp.packer.version | Cancelled version revocation |
HCP Packer delivers a webhook payload with the common fields when a version scheduled revocation is cancelled.
Assigned version to channel
Action | Source | Description |
---|---|---|
assign | hashicorp.packer.version | Assigned version to channel |
HCP Packer delivers a webhook payload when a version is either assigned or unassigned from a channel.
The following fields are available in the webhook event payload next to the common fields.
Field | Type | Description |
---|---|---|
previous_version | string | The version previously assigned to the channel. Present only if a version was previously assigned to the channel. |
previous_version.id | string | ID of the version. |
previous_version.fingerprint | string | User-given build identifier. |
previous_version.name | string | Human-readable name of the version incrementally set when all builds are successful. |
previous_builds | array | List of builds built in the version previously assigned to the channel. Present only in the case of a previously assigned version. |
previous_builds.id | string | ID of the build. |
previous_builds.platform | string | Plaftorm of the build. For example, aws or azure . |
previous_builds.component_type | string | Builder or post-processor used on the build. For example, amazon-ebs.ubuntu . |
previous_builds.labels | json | Labels of the build. |
previous_builds.artifacts | array | Artifacts built by the build. |
previous_builds.artifacts.region | string | Region of the artifact. For example, eu-west-1 . |
previous_builds.artifacts.external_identifier | string | External identifier of the artifact. For example, ami-13245456 . |
channel.id | string | ID of the channel. |
channel.name | string | The user readable name of the channel. |
channel.author_id | string | ID of the actor who create the channel. |
channel.managed | bool | Indicates whether the channel is managed by HCP Packer. HCP Packer-managed channels are also identified as the latest channel. |
channel.restricted | bool | Indicates whether the channel is restricted. |
Example payload of a Assigned version to channel
event.
{
"resource_id": "01HAVMCV8XWW945TNKT2KPYSN1",
"resource_name": "packer/project/ff99bac7-eaec-40a1-8f55-5eb05e789401/registry/01HAVMCV8XWW945TNKT2KPYSN1",
"event_id": "packer.event:fHcFpzWPwWMtmbpGBtLC",
"event_action": "assign",
"event_description": "Assigned version to channel",
"event_source": "hashicorp.packer.version",
"event_version": "1",
"event_payload": {
"actor": {
"principal_id": "ac7295a2-85ef-4594-b4c6-3a1f8b733f1a",
"type": "TYPE_USER",
"user": {
"email": "user@email.com",
"id": "d8f45791-460d-434e-8a40-f627e752276a",
"name": "User Name"
}
},
"bucket": {
"id": "01HAVMDEAXNF5RYDDSK5R39HDP",
"name": "test"
},
"channel": {
"author_id": "HCP Packer",
"id": "01HAVMHSBWQ3952KWR50YBHZA4",
"managed": true,
"restricted": true,
"name": "latest"
},
"version": {
"fingerprint": "01HAVMD1YBM4PA1KHNYFAYJREM",
"id": "01HAVMD63G58XDA8JKS2B8J871",
"name": "v2"
},
"builds":[
{
"platform":"aws",
"component_type":"amazon-ebs.ubuntu",
"id":"01HP1XWZ1EADV8VVKV6J4VHM6S",
"artifacts":[
{
"external_identifier":"ami-f3",
"region":"us-west-2"
}
],
"labels":{
"os":"ubuntu"
}
}
],
"organization_id": "6a171c1d-c7cd-4047-ba1a-92d686dde2ed",
"previous_version": {
"fingerprint": "01HAVMJG6R3KFAN7603RDZCGTC",
"id": "01HAVMJKRSPRPQ30JJEW3Q5084",
"name": "v1"
},
"previous_builds":[
{
"platform":"aws",
"component_type":"amazon-ebs.ubuntu",
"id":"01H5APPBYYF4D0NMVZCRKR85E7",
"artifacts":[
{
"external_identifier":"ami-f2",
"region":"us-west-2"
}
],
"labels":{
"os":"ubuntu"
}
}
],
"project_id": "ff99bac7-eaec-40a1-8f55-5eb05e789401",
"registry": {
"id": "01HAVMCV8XWW945TNKT2KPYSN1"
}
}
}