File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,24 @@ steps:
291
291
- my-custom-plugin#v1.0.0:
292
292
` ` `
293
293
294
+ # ## Specifying tags to apply to the pushed Docker image
295
+
296
+ By default, the image is tagged with the `latest` tag in addition to the cache key.
297
+
298
+ By specifying the `tags` parameter you can specify your own set of tags to apply to the image :
299
+
300
+ ` ` ` yaml
301
+ steps:
302
+ - command: echo wow
303
+ plugins:
304
+ - seek-oss/docker-ecr-cache#v2.0.0:
305
+ tags:
306
+ - latest
307
+ - build-${BUILDKITE_BUILD_NUMBER}
308
+ ` ` `
309
+
310
+ Specifying your own tags makes it easy to reuse the image later in the pipeline.
311
+
294
312
# ## AWS ECR specific configuration
295
313
296
314
# ### Specifying an ECR repository name
Original file line number Diff line number Diff line change @@ -71,13 +71,24 @@ if ! docker pull "${image}:${tag}"; then
71
71
docker " ${image_build_args[@]} " ${BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_ADDITIONAL_BUILD_ARGS:- } " ${context} " ||
72
72
log_fatal " ^^^ +++" 1
73
73
74
- docker tag " ${image} :${tag} " " ${image} :latest"
75
-
76
- echo " --- Pushing tag ${tag} "
74
+ echo " --- Pushing tags"
75
+ echo " - ${tag} "
77
76
docker push " ${image} :${tag} "
78
77
79
- echo " --- Pushing tag latest"
80
- docker push " ${image} :latest"
78
+ results=()
79
+ read_list_property ' TAGS'
80
+ if [ " ${# result[*]} " == " 0" ]; then
81
+ echo " - latest"
82
+ docker tag " ${image} :${tag} " " ${image} :latest"
83
+ docker push " ${image} :latest"
84
+ else
85
+ for other_tag in ${result[@]+" ${result[@]} " } ; do
86
+ echo " - ${other_tag} "
87
+ docker tag " ${image} :${tag} " " ${image} :${other_tag} "
88
+ docker push " ${image} :${other_tag} "
89
+ done
90
+ fi
91
+
81
92
fi || echo " Not found"
82
93
83
94
# Support using https://github.com/buildkite-plugins/docker-buildkite-plugin without an image by default
Original file line number Diff line number Diff line change @@ -33,4 +33,6 @@ configuration:
33
33
type : string
34
34
region :
35
35
type : string
36
+ tags :
37
+ type : [array, string]
36
38
required : []
You can’t perform that action at this time.
0 commit comments