»Image Channels
Hands On: Try the Control Image with Channels tutorial on HashiCorp Learn.
Image channels assign iterations to human-readable names that consumers can reference in Packer templates and Terraform configurations. You can update the iteration associated with the channel as you release new image versions. This allows consumers to 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 will automatically use the channel’s latest image version the next time they execute pipelines that request image metadata from that channel.
You can create, update, and delete image channels in the UI as shown below or with the HCP Packer API.
Create Image Channels
You can only assign iterations to a channel when they are complete and the registry has assigned them a version number. To create, edit, or delete a channel:
Click Packer in the left sidebar. The HCP Packer page appears with a list of all existing image buckets in your organization.
Click an image bucket to open its Overview page and then click Channels in the left sidebar. The Manage Channels page appears.
Click + New Channel and complete the fields in the Create new channel box:
- Channel name: This is the string that consumers will use to reference this iteration in code. Choose something short and descriptive.
- Assign to an iteration: Choose the iteration for the version you want consumers to use when they reference this channel. You can also leave the iteration blank to create a placeholder for future iterations.
Click Create channel. The new channel is visible on the Manage channels page and consumers can begin using the channel name in their code.
Edit and Delete Image Channels
HCP Packer does not notify consumers when an image channel has been changed or deleted, so make changes cautiously. To edit or delete an existing image channel:
Go to an image bucket and click Channels in the left sidebar. The Manage Channels page appears with a list of all existing channels in this image bucket.
Click the three dots next to the channel you want to edit or delete and select an option:
- Change assigned iteration: Choose another iteration and click Update Channel.
- Delete Channel: If you are sure you want to delete this channel, click Delete.
Restore Deleted Image Channels
To restore a deleted image channel, add a new channel with the same channel name and assigned iteration.
Automatic 'latest' Channel
Every image bucket has a latest
channel by default. This channel is managed by HCP Packer and is automatically updated to the newest unrevoked iteration available in the bucket.
You can use the latest
channel in Packer and Terraform templates like other user-managed image channels.
You can not change the iteration assigned to a bucket's latest
channel or delete the channel.