Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:refactor-libs into ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:master

Proposed by Sergio Durigan Junior
Status: Merged
Merged at revision: c31e84354f612a1f046c5253c081ab0e0954f7ba
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:refactor-libs
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:master
Diff against target: 570 lines (+181/-148)
7 files modified
helpers/validate-args.sh (+4/-4)
lib/image.sh (+73/-0)
lib/tag.sh (+51/-0)
list-all-images.sh (+5/-23)
list-tags-for-image.sh (+7/-27)
multi-arch-tagger.sh (+10/-38)
tag-images.sh (+31/-56)
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Canonical Server Pending
Review via email: mp+400998@code.launchpad.net

Description of the change

I've been meaning to do this for a while now, and since I'm working expanding these scripts and implement a way to print a manifest file from a registry, I decided to finally take some time to refactor a bit.

The idea behind this MP is to turn the existing standalone code we're carrying inside the scripts into "libraries" that can be sourced. This makes it easier to share code between the scripts, share credentials, and also simplify the validation of the arguments (now, only one validation will happen, performed by the scripts that's been called by the user).

I've tested this and it seems to be working OK, but I'd appreciate if another pair(s) of eyes could take a look.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

I like it, this is a good step in the right direction. It's not only cleaner, but probably safer since there won't be need to pass credentials from process to subprocess.

The logic itself looks good; this mostly is just moving the existing (already-reviewed) code.

As part of moving this code to be used more broadly, as polish I'd also suggest this may be a good time to tighten up input variable checks, and perhaps think about code docs too. And a few other items along those lines down below - all just suggestions, pick and choose as you wish.

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the review, Bryce!

I agree with everything you've said. I have a few comments/follow-ups.

Revision history for this message
Bryce Harrington (bryce) wrote :

Looks great.

If there are no actual subprocesses that require AUTH_TOKEN, it might be safer to not export it (all the sourced lib files will still have access to it even if not exported).

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Oh one other thought, I'm curious about the distinction between helpers/ and lib/. I would think all these sourceable files could live together in one subdir, but maybe you have a plan in mind?

Revision history for this message
Bryce Harrington (bryce) wrote :

Oh another note, rather than calling the file list.sh (which may sound like utilities for manipulating bash arrays or other lists of things), could call it images.sh since that describes the main objects we're working with here?

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Monday, April 12 2021, Bryce Harrington wrote:

> Oh one other thought, I'm curious about the distinction between
> helpers/ and lib/. I would think all these sourceable files could
> live together in one subdir, but maybe you have a plan in mind?

Hm, not really. I think it just felt more natural to put these
functions into a "lib/" dir because "helper/" seems like something that
will help the script prepare itself for the real job that it's supposed
to do. I'll leave as is for now, but we can revisit this later.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Monday, April 12 2021, Bryce Harrington wrote:

> Oh another note, rather than calling the file list.sh (which may sound
> like utilities for manipulating bash arrays or other lists of things),
> could call it images.sh since that describes the main objects we're
> working with here?

OK, good point, I'll rename the file.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/helpers/validate-args.sh b/helpers/validate-args.sh
2index 551c6f7..84ccd6b 100644
3--- a/helpers/validate-args.sh
4+++ b/helpers/validate-args.sh
5@@ -7,6 +7,8 @@ export progname progdir
6
7 # shellcheck disable=SC1090
8 . "${progdir}/helpers/log.sh"
9+# shellcheck disable=SC1090
10+. "${progdir}/lib/image.sh"
11
12 validate_var ()
13 {
14@@ -71,10 +73,8 @@ validate_image ()
15
16 # shellcheck disable=SC2153
17 # Fill the ALL_IMAGES array.
18- readarray -t ALL_IMAGES < <("${progdir}/list-all-images.sh" \
19- -r "$REGISTRY" \
20- -n "$NAMESPACE" \
21- -a "$AUTH_TOKEN")
22+ readarray -t ALL_IMAGES < <(print_list_of_images \
23+ "${REGISTRY}" "${NAMESPACE}")
24
25 if ! grep -Fwq "$image" <<< "${ALL_IMAGES[@]}"; then
26 error "Invalid image name '$image'."
27diff --git a/lib/image.sh b/lib/image.sh
28new file mode 100644
29index 0000000..a719c41
30--- /dev/null
31+++ b/lib/image.sh
32@@ -0,0 +1,73 @@
33+#!/bin/bash
34+
35+# This script is intended to be sourced.
36+
37+## List images ##
38+
39+_print_list_of_images_docker ()
40+{
41+ [ -n "${NAMESPACE}" ] || return 1
42+ [ -n "${DOCKERHUB_URL}" ] || return 1
43+ [ -n "${AUTH_TOKEN}" ] || return 1
44+
45+ for image in $(curl -s \
46+ -H "Authorization: Bearer ${AUTH_TOKEN}" \
47+ "${DOCKERHUB_URL}/v2/repositories/${NAMESPACE}/?page_size=10000" \
48+ | jq -r '.results|.[]|.name'); do
49+ echo "$image"
50+ done
51+}
52+
53+_print_list_of_images_aws ()
54+{
55+ aws --region us-east-1 ecr-public describe-repositories \
56+ | jq -r '.repositories[].repositoryName'
57+}
58+
59+print_list_of_images ()
60+{
61+ [ -n "${REGISTRY}" ] || return 1
62+
63+ _print_list_of_images_"${REGISTRY}"
64+}
65+
66+## List tags ##
67+
68+_print_tags_for_image_docker ()
69+{
70+ local image="$1"
71+
72+ [ -n "${NAMESPACE}" ] || return 1
73+ [ -n "${AUTH_TOKEN}" ] || return 1
74+ [ -n "${DOCKERHUB_URL}" ] || return 1
75+ [ -n "${image}" ] || return 1
76+
77+ for tag in $(curl -s \
78+ -H "Authorization: JWT ${AUTH_TOKEN}" \
79+ "${DOCKERHUB_URL}/v2/repositories/${NAMESPACE}/${image}/tags/?page_size=10000" \
80+ | jq -r '.results|.[]|.name'); do
81+ echo "${tag}"
82+ done
83+}
84+
85+_print_tags_for_image_aws ()
86+{
87+ local image="$1"
88+
89+ [ -n "${image}" ] || return 1
90+
91+ for tag in $(aws --region us-east-1 ecr-public describe-image-tags --repository-name "${image}" \
92+ | jq -r '.imageTagDetails[].imageTag'); do
93+ echo "${tag}"
94+ done
95+}
96+
97+print_tags_for_image ()
98+{
99+ local image="$1"
100+
101+ [ -n "${REGISTRY}" ] || return 1
102+ [ -n "${image}" ] || return 1
103+
104+ _print_tags_for_image_"${REGISTRY}" "${image}"
105+}
106diff --git a/lib/tag.sh b/lib/tag.sh
107new file mode 100644
108index 0000000..2679401
109--- /dev/null
110+++ b/lib/tag.sh
111@@ -0,0 +1,51 @@
112+#!/bin/bash
113+
114+# This script is intended to be sourced.
115+
116+## Tag image ##
117+
118+tag_image ()
119+{
120+ local image="$1"
121+ local source_tag="$2"
122+ local tag="$3"
123+
124+ [ -n "${REGISTRY}" ] || return 1
125+ [ -n "${NAMESPACE}" ] || return 1
126+ [ -n "${image}" ] || return 1
127+ [ -n "${source_tag}" ] || return 1
128+ [ -n "${tag}" ] || return 1
129+ [ -n "${REGISTRY_AUTH_TOKEN}" ] || return 1
130+ [ -n "${REGISTRY_URL}" ] || return 1
131+
132+ info "Tagging ${NAMESPACE}/${image}:${source_tag} as ${NAMESPACE}/${image}:${tag} (on ${REGISTRY})"
133+
134+ local tmpfile
135+ local ret
136+
137+ tmpfile=$(mktemp)
138+ trap 'rm -f ${tmpfile}' 0 INT QUIT ABRT PIPE TERM
139+
140+ ret=$(curl -s -H "Authorization: Bearer ${REGISTRY_AUTH_TOKEN}" \
141+ -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
142+ "${REGISTRY_URL}/v2/${NAMESPACE}/${image}/manifests/${source_tag}" \
143+ -s -o "${tmpfile}" -w "%{http_code}" || true)
144+
145+ if [ $ret -ne 200 ]; then
146+ error "Unable to obtain manifest file for image (return code $ret)"
147+ fi
148+
149+ # We use "|| true" here because we want the command to complete
150+ # even if it fails. We check for the HTTP response code below.
151+ ret=$(curl -X PUT -H "Authorization: Bearer ${REGISTRY_AUTH_TOKEN}" \
152+ -H "Content-Type: application/vnd.docker.distribution.manifest.list.v2+json" \
153+ "${REGISTRY_URL}/v2/${NAMESPACE}/${image}/manifests/${tag}" \
154+ -d "@${tmpfile}" \
155+ -s -o /dev/null -w "%{http_code}" || true)
156+
157+ rm "$tmpfile"
158+
159+ if [ $ret -ne 201 ]; then
160+ error "Image tagging failed with status code $ret"
161+ fi
162+}
163diff --git a/list-all-images.sh b/list-all-images.sh
164index c82b50c..63493a4 100755
165--- a/list-all-images.sh
166+++ b/list-all-images.sh
167@@ -11,6 +11,8 @@ progdir=$(dirname "$(readlink -f "${0}")")
168 . "${progdir}/helpers/log.sh"
169 # shellcheck disable=SC1090
170 . "${progdir}/helpers/registry-login.sh"
171+# shellcheck disable=SC1090
172+. "${progdir}/lib/image.sh"
173
174 # Obtain the list of images for a certain repository.
175
176@@ -62,27 +64,6 @@ validate_args ()
177 do_login
178 }
179
180-print_list_of_images_docker ()
181-{
182- for image in $(curl -s \
183- -H "Authorization: Bearer ${AUTH_TOKEN}" \
184- "${DOCKERHUB_URL}/v2/repositories/${NAMESPACE}/?page_size=10000" \
185- | jq -r '.results|.[]|.name'); do
186- echo "$image"
187- done
188-}
189-
190-print_list_of_images_aws ()
191-{
192- aws --region us-east-1 ecr-public describe-repositories \
193- | jq -r '.repositories[].repositoryName'
194-}
195-
196-print_list_of_images ()
197-{
198- print_list_of_images_"${REGISTRY}"
199-}
200-
201 if [ $# -lt 2 ]; then
202 error "You need to provide at least the registry (-r) and the namespace (-n) arguments."
203 usage
204@@ -92,17 +73,18 @@ fi
205 while [ -n "$1" ]; do
206 case "$1" in
207 "-a"|"--auth-token")
208+ # shellcheck disable=SC2034
209 AUTH_TOKEN="$2"
210 shift 2
211 ;;
212
213 "-r"|"--registry")
214- REGISTRY="$2"
215+ export REGISTRY="$2"
216 shift 2
217 ;;
218
219 "-n"|"--namespace")
220- NAMESPACE="$2"
221+ export NAMESPACE="$2"
222 shift 2
223 ;;
224
225diff --git a/list-tags-for-image.sh b/list-tags-for-image.sh
226index 305c9be..67380f8 100755
227--- a/list-tags-for-image.sh
228+++ b/list-tags-for-image.sh
229@@ -11,6 +11,8 @@ progdir=$(dirname "$(readlink -f "${0}")")
230 . "${progdir}/helpers/log.sh"
231 # shellcheck disable=SC1090
232 . "${progdir}/helpers/registry-login.sh"
233+# shellcheck disable=SC1090
234+. "${progdir}/lib/image.sh"
235
236 # Obtain the list of tags for a certain image.
237
238@@ -67,29 +69,6 @@ validate_args ()
239 validate_image "$IMAGE"
240 }
241
242-print_tags_for_image_docker ()
243-{
244- for tag in $(curl -s \
245- -H "Authorization: JWT ${AUTH_TOKEN}" \
246- "${DOCKERHUB_URL}/v2/repositories/${NAMESPACE}/${IMAGE}/tags/?page_size=10000" \
247- | jq -r '.results|.[]|.name'); do
248- echo "${tag}"
249- done
250-}
251-
252-print_tags_for_image_aws ()
253-{
254- for tag in $(aws --region us-east-1 ecr-public describe-image-tags --repository-name "${IMAGE}" \
255- | jq -r '.imageTagDetails[].imageTag'); do
256- echo "${tag}"
257- done
258-}
259-
260-print_tags_for_image ()
261-{
262- print_tags_for_image_"${REGISTRY}"
263-}
264-
265 if [ $# -lt 2 ]; then
266 error "You need to provide at least the registry (-r), the namespace (-n) and the image (-i) arguments."
267 usage
268@@ -99,22 +78,23 @@ fi
269 while [ -n "$1" ]; do
270 case "$1" in
271 "-a"|"--auth-token")
272+ # shellcheck disable=SC2034
273 AUTH_TOKEN="$2"
274 shift 2
275 ;;
276
277 "-r"|"--registry")
278- REGISTRY="$2"
279+ export REGISTRY="$2"
280 shift 2
281 ;;
282
283 "-n"|"--namespace")
284- NAMESPACE="$2"
285+ export NAMESPACE="$2"
286 shift 2
287 ;;
288
289 "-i"|"--image")
290- IMAGE="$2"
291+ export IMAGE="$2"
292 shift 2
293 ;;
294
295@@ -138,4 +118,4 @@ done
296
297 validate_args
298
299-print_tags_for_image
300+print_tags_for_image "${IMAGE}"
301diff --git a/multi-arch-tagger.sh b/multi-arch-tagger.sh
302index a493fa2..2b63ee5 100755
303--- a/multi-arch-tagger.sh
304+++ b/multi-arch-tagger.sh
305@@ -11,6 +11,8 @@ progdir=$(dirname "$(readlink -f "${0}")")
306 . "${progdir}/helpers/log.sh"
307 # shellcheck disable=SC1090
308 . "${progdir}/helpers/registry-login.sh"
309+# shellcheck disable=SC1090
310+. "${progdir}/lib/image.sh"
311
312 # Tag all architectures of an image.
313
314@@ -76,37 +78,6 @@ Arguments:
315 EOF
316 }
317
318-do_tag_image ()
319-{
320- info "Tagging ${NAMESPACE}/${IMAGE}:${SOURCE_TAG} as ${NAMESPACE}/${IMAGE}:${TAG} (on ${REGISTRY})"
321-
322- local tmpfile
323- local ret
324-
325- tmpfile=$(mktemp)
326- trap 'rm -f ${tmpfile}' 0 INT QUIT ABRT PIPE TERM
327-
328- curl -s -H "Authorization: Bearer ${REGISTRY_AUTH_TOKEN}" \
329- -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
330- "${REGISTRY_URL}/v2/${NAMESPACE}/${IMAGE}/manifests/${SOURCE_TAG}" \
331- > "$tmpfile"
332-
333- # We use "|| true" here because we want the command to complete
334- # even if it fails. We check for the HTTP response code below.
335- ret=$(curl -X PUT -H "Authorization: Bearer ${REGISTRY_AUTH_TOKEN}" \
336- -H "Content-Type: application/vnd.docker.distribution.manifest.list.v2+json" \
337- "${REGISTRY_URL}/v2/${NAMESPACE}/${IMAGE}/manifests/${TAG}" \
338- -d "@${tmpfile}" \
339- -s -o /dev/null -w "%{http_code}" || true)
340-
341- rm "$tmpfile"
342-
343- if [ "$ret" -ne 201 ]; then
344- echo "ERROR: Image tagging failed with status code $ret"
345- exit 1
346- fi
347-}
348-
349 do_registry_login ()
350 {
351 _login_"${REGISTRY}"_registry1 "$IMAGE" "$REGISTRY_USERNAME" "$REGISTRY_PASSWORD"
352@@ -158,32 +129,33 @@ fi
353 while [ -n "$1" ]; do
354 case "$1" in
355 "-a"|"--auth-token")
356- export AUTH_TOKEN="$2"
357+ # shellcheck disable=SC2034
358+ AUTH_TOKEN="$2"
359 shift 2
360 ;;
361
362 "-r"|"--registry")
363- REGISTRY="$2"
364+ export REGISTRY="$2"
365 shift 2
366 ;;
367
368 "-n"|"--namespace")
369- NAMESPACE="$2"
370+ export NAMESPACE="$2"
371 shift 2
372 ;;
373
374 "-i"|"--image")
375- IMAGE="$2"
376+ export IMAGE="$2"
377 shift 2
378 ;;
379
380 "-s"|"--source-tag")
381- SOURCE_TAG="$2"
382+ export SOURCE_TAG="$2"
383 shift 2
384 ;;
385
386 "-t"|"--tag")
387- TAG="$2"
388+ export TAG="$2"
389 shift 2
390 ;;
391
392@@ -217,4 +189,4 @@ done
393
394 validate_args
395
396-do_tag_image
397+tag_image "${IMAGE}" "${SOURCE_TAG}" "${TAG}"
398diff --git a/tag-images.sh b/tag-images.sh
399index d669d86..589fa0e 100755
400--- a/tag-images.sh
401+++ b/tag-images.sh
402@@ -11,17 +11,21 @@ progdir=$(dirname "$(readlink -f "${0}")")
403 . "${progdir}/helpers/log.sh"
404 # shellcheck disable=SC1090
405 . "${progdir}/helpers/registry-login.sh"
406+# shellcheck disable=SC1090
407+. "${progdir}/lib/image.sh"
408+# shellcheck disable=SC1090
409+. "${progdir}/lib/tag.sh"
410
411 # Tag images from a repository.
412
413 # The list of images to tag.
414-IMAGES=()
415+export IMAGES=()
416
417 # The list of all available images.
418-ALL_IMAGES=()
419+export ALL_IMAGES=()
420
421 # List of images to be excluded from the the processing.
422-EXCLUDE_IMAGES=()
423+export EXCLUDE_IMAGES=()
424
425 # Usage.
426 usage ()
427@@ -107,11 +111,7 @@ do_tag_base_ubuntu_image ()
428
429 local -a IMAGE_TAGS EDGE_TAGS
430
431- readarray -t IMAGE_TAGS < <("${progdir}/list-tags-for-image.sh" \
432- -a "$AUTH_TOKEN" \
433- -r "$REGISTRY" \
434- -n "$NAMESPACE" \
435- -i "$image")
436+ readarray -t IMAGE_TAGS < <(print_tags_for_image "${image}")
437
438 readarray -t EDGE_TAGS < <(printf '%s\n' "${IMAGE_TAGS[@]}" \
439 | grep -E '^[[:alpha:]]+-[[:digit:]]+\.[[:digit:]]+_edge$')
440@@ -134,44 +134,29 @@ do_tag_base_ubuntu_image ()
441 # Tag each suffix.
442 if [ -n "$FORCE" ] || ! grep -Fwq "${IMG_RELEASEVER}_${tagsuffix}" <<< "${IMAGE_TAGS[@]}"; then
443 info "Invoking multi-arch tagger for ${NAMESPACE}/${image}:${IMG_RELEASEVER}_${tagsuffix} (source tag: ${EDGE_TAG_PREFIX}_edge) (on ${REGISTRY})"
444- "${progdir}/multi-arch-tagger.sh" \
445- -a "$AUTH_TOKEN" \
446- -r "$REGISTRY" \
447- -n "$NAMESPACE" \
448- -i "$image" \
449- -s "${EDGE_TAG_PREFIX}_edge" \
450- -t "${IMG_RELEASEVER}_${tagsuffix}" \
451- -u "$USERNAME" \
452- -p "$PASSWORD"
453+ tag_image \
454+ "${image}" \
455+ "${EDGE_TAG_PREFIX}_edge" \
456+ "${IMG_RELEASEVER}_${tagsuffix}"
457 fi
458 done
459
460 # Tag the DISTRONAME.
461 if [ -n "$FORCE" ] || ! grep -Fwq "${IMG_DISTRONAME}" <<< "${IMAGE_TAGS[@]}"; then
462 info "Invoking multi-arch tagger for ${NAMESPACE}/${image}:${IMG_DISTRONAME} (source tag: ${EDGE_TAG_PREFIX}_edge) (on ${REGISTRY})"
463- "${progdir}/multi-arch-tagger.sh" \
464- -a "$AUTH_TOKEN" \
465- -r "$REGISTRY" \
466- -n "$NAMESPACE" \
467- -i "$image" \
468- -s "${EDGE_TAG_PREFIX}_edge" \
469- -t "${IMG_DISTRONAME}" \
470- -u "$USERNAME" \
471- -p "$PASSWORD"
472+ tag_image \
473+ "${image}" \
474+ "${EDGE_TAG_PREFIX}_edge" \
475+ "${IMG_DISTRONAME}"
476 fi
477
478 # Tag the RELEASEVER
479 if [ -n "$FORCE" ] || ! grep -Fwq "${IMG_RELEASEVER}" <<< "${IMAGE_TAGS[@]}"; then
480 info "Invoking multi-arch tagger for ${NAMESPACE}/${image}:${IMG_RELEASEVER} (source tag: ${EDGE_TAG_PREFIX}_edge) (on ${REGISTRY})"
481- "${progdir}/multi-arch-tagger.sh" \
482- -a "$AUTH_TOKEN" \
483- -r "$REGISTRY" \
484- -n "$NAMESPACE" \
485- -i "$image" \
486- -s "${EDGE_TAG_PREFIX}_edge" \
487- -t "${IMG_RELEASEVER}" \
488- -u "$USERNAME" \
489- -p "$PASSWORD"
490+ tag_image \
491+ "${image}" \
492+ "${EDGE_TAG_PREFIX}_edge" \
493+ "${IMG_RELEASEVER}"
494 fi
495 done
496 }
497@@ -195,11 +180,7 @@ do_tag_images ()
498
499 local -a IMAGE_TAGS EDGE_TAGS
500
501- readarray -t IMAGE_TAGS < <("${progdir}/list-tags-for-image.sh" \
502- -a "$AUTH_TOKEN" \
503- -r "$REGISTRY" \
504- -n "$NAMESPACE" \
505- -i "$image")
506+ readarray -t IMAGE_TAGS < <(print_tags_for_image "${image}")
507
508 # Get the list of all M.N-XX.YY_edge tags, and sort them
509 # according to the release numbers. In the end, we will have
510@@ -234,15 +215,10 @@ do_tag_images ()
511 # corresponding 'M.N-XX.YY_beta' tag associated with
512 # the '_edge' tag, so we need to create it.
513 info "Invoking multi-arch tagger for ${NAMESPACE}/${image}:${suptag} (source tag: ${EDGE_TAG_PREFIX}_edge) (on ${REGISTRY})"
514- "${progdir}/multi-arch-tagger.sh" \
515- -a "$AUTH_TOKEN" \
516- -r "$REGISTRY" \
517- -n "$NAMESPACE" \
518- -i "$image" \
519- -s "${EDGE_TAG_PREFIX}_edge" \
520- -t "${suptag}" \
521- -u "$USERNAME" \
522- -p "$PASSWORD"
523+ tag_image \
524+ "${image}" \
525+ "${EDGE_TAG_PREFIX}_edge" \
526+ "${suptag}"
527 fi
528 done
529 tagidx=$((++tagidx))
530@@ -268,10 +244,7 @@ validate_args ()
531 do_login
532
533 # Fill the ALL_IMAGES array.
534- readarray -t ALL_IMAGES < <("${progdir}/list-all-images.sh" \
535- -r "$REGISTRY" \
536- -n "$NAMESPACE" \
537- -a "$AUTH_TOKEN")
538+ readarray -t ALL_IMAGES < <(print_list_of_images)
539
540 if [ "${#IMAGES[@]}" -eq 0 ]; then
541 # The user hasn't provided any image names, so just use all of
542@@ -310,6 +283,8 @@ validate_args ()
543 readarray -t IMAGES <<< "${NEW_IMAGES[@]}"
544 unset NEW_IMAGES
545 fi
546+
547+ _login_"${REGISTRY}"_registry1 "${IMAGES[@]}" "$USERNAME" "$PASSWORD"
548 }
549
550 if [ $# -lt 2 ]; then
551@@ -321,17 +296,17 @@ fi
552 while [ -n "$1" ]; do
553 case "$1" in
554 "-r"|"--registry")
555- REGISTRY="$2"
556+ export REGISTRY="$2"
557 shift 2
558 ;;
559
560 "-n"|"--namespace")
561- NAMESPACE="$2"
562+ export NAMESPACE="$2"
563 shift 2
564 ;;
565
566 "-f"|"--force")
567- FORCE=1
568+ export FORCE=1
569 shift
570 ;;
571

Subscribers

People subscribed via source and target branches

to all changes: