Create and manage channels
This topic describes how to create and manage channels in HCP Packer. Channels are human-readable names that artifact creators can assign base artifacts to. Artifact consumers can use channels in their Packer templates or Terraform configurations, instead of hard-coding the artifact versions, so that they automatically use the correct version in their applications.
Hands On: Complete the Control artifacts with channels tutorial to get started.
Overview
You can create, update, and delete channels in the HCP Packer UI or with the HCP Packer API. The following outline describes the expected workflow for using channels:
- Build a version of the artifact and push the metadata to HCP Packer. Refer to Push metadata to HCP Packer
- Create one or more channels in the HCP Packer UI and assign the artifacts to their appropriate channels.
- Artifact consumers use the channel names in their Packer templates or Terraform configurations. When they build downstream artifacts, Packer or Terraform automatically pull the appropriate version of the artifact. Refer to [Reference artifact metadata]](/hcp/docs/packer/store/reference) for additional information.
- Update the artifact associated with the channel as you release new versions. As a result, consumers automatically reference the correct version on the registry without having to update their code.
Updating a channel does not automatically notify downstream consumers or trigger downstream Packer builds or Terraform runs. Consumers automatically use the channel’s latest version the next time they execute pipelines that request artifact metadata from that channel.
Latest channel
Every bucket has a latest
channel by default. This channel is managed by HCP Packer and is automatically updated to the newest unrevoked version available in the bucket.
You can use the latest
channel in Packer and Terraform templates.
You can not change the version assigned to a bucket's latest
channel or delete the channel.
Create channels
You can only assign versions to a channel when they are complete and the registry has assigned them a version number.
- From the HCP portal, click Packer in the Services sidebar.
- Click a bucket in the Artifact ID column.
- Click Channels in the sidebar.
- Click + New Channel and specify a name. You must enter a unique string. Note that
latest
is a reserved channel name that HCP Packer automatically creates. Refer to Latest channel for additional information. - Choose a version from the Assign to a version: drop-down menu. This version is automatically used to build downstream artifacts when consumers reference the channel name in their Packer templates or Terraform configurations. You can also leave the version blank to create a placeholder for future versions.
- Enable one of the following options in the Channel access field:
- Unrestricted: The channel is visible to every member of your organization.
- Restricted: The channel is visible to users in your organization that have permission to create, edit, and delete resources. Refer to Secure channel access for additional information.
- Click Create channel.
View channel details
The HCP Packer UI shows information about the artifact versions assigned to your channels.
- From the HCP portal, click Packer in the Services sidebar.
- Click a bucket in the Artifact ID column to open its Overview screen.
- Click Channels in the sidebar to open the Channels screen.
- Click on a channel to open its Overview screen appears. The overview shows the following information:
- Assigned version.
- Assignment history. HCP stores the history for up to one year. The number of entries depends on your subscription tier. Refer to the Packer pricing page to learn about available tiers. Refer to View and Change Registry Tier to upgrade the HCP Packer registry tier.
- Ancestry status. The overview page lets you know when an artifact is outdated. Refer to View ancestry for additional information.
Edit and delete channels
When you delete a channel, HCP Packer also permanently deletes its assignment history. We recommend notifying consumers when making changes to the channel. HCP Packer does not notify consumers about changes.
- Go to a bucket and click Channels in the sidebar. The Channels screen appears with a list of all existing channels in this bucket.
- Open the ellipses menu for the channel you want to edit or delete.
- You can perform the following actions:
- Edit assigned version: Choose another version and click Update Channel.
- Edit channel access: Choose a different channel access type and click Confirm.
- Delete Channel: If you are sure you want to delete this channel, click Delete.
Restore deleted channels
To restore a deleted channel, add a new channel with the same channel name and assigned version.
Secure channel access
You can restrict channel access to only users with the contributor or admin role for the organization or project. Refer to Users for additional information.
Restricted channels enable you to validate and test artifacts before making them available to downstream consumers in unrestricted channels.
Restricted channels are not visible to users assigned the viewer role.
Next steps
You can use the HCL generator on the HCP Packer channel overview screen to create a data source snippet for the Packer or Terraform configuration languages. We recommend using data sources to retrieve artifact metadata for building children with Packer or deploying an artifact with Terraform. Refer to Reference artifact metadata for instructions.