HashiCorp Packer generates image IDs, like ami-387dc380
.
When creating a build chain with separate configurations for building, testing, and deploying images, we need to reference their IDs.
This is a Packer plugin, which saves the generated image IDs as parameters in the build history:
Packer can run multiple builders in parallel, so a single build can produce several artifacts. Custom builder names can be used to distinguish them.
For AMIs in AWS, there is a special format, two parameters are published for each artifact:
Now dependent build configurations can reference these parameters and resolve the image IDs dynamically:
- Download the binaries from the Releases page.
- Install the plugin on build agents.
- Add the TeamCity post-processor to Packer configurations:
{
"builders": [
{
"name":"agent",
"type": "amazon-ebs",
.......
}
],
"post-processors": [
"teamcity"
]
}
Optionally the plugin can be used to deploy new versions of TeamCity cloud agents: after the images are created Packer registrs them in cloud agent profiles on TeamCity server:
This feature works with vSphere only. See #3 |
---|
{
"builders": [
{
"name": "agent",
.......
}
],
"post-processors": [
{
"type": "teamcity",
"teamcity_url": "https://teamcity.local",
"username": "admin",
"password": "secret",
"project_id": "_Root",
"custom_image_name": "{{build_name}}",
"agent_name": "{{build_name}}-{{user `build_number`}}"
}
]
}