Retag docker images in AWS ECR based on a lightweight approach described in AWS documentation
Add the following to your pipeline.yml
:
steps:
- key: tag-docker-image-ecr
plugins:
- peakon/ecr-tag#v0.0.4:
registry-id: ${AWS_ACCOUNT_ID}
repository: ${BUILDKITE_PIPELINE_NAME}
tag: ${BUILDKITE_COMMIT}
new-tags:
- ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}
- ${BUILDKITE_BRANCH}
- AWS cli, jq
- AWS IAM Permissions that allow
BatchGetImage
andPutImage
operations.
property | description |
---|---|
registry-id | ECR registry ID (AWS account id) |
repository | ECR repository name |
tag | Existing docker image tag |
new-tags | Array of tags to be created |
You can specify a custom AWS profile to be used by AWS CLI
- in pipeline YAML (
aws_profile: profile_name
) - as
BUILDKITE_PLUGIN_ECR_TAG_AWS_PROFILE
environment variable (e.g. inside agent environment hook).
To run the tests:
docker-compose run --rm tests
- Fork the repo
- Make the changes
- Run shellcheck and plugin lint
- Commit and push your changes
- Send a pull request
8aa7528 (Initial commit)