|
48 | 48 | if [[ "${PULL_BASE_REF}" == controller/* ]]; then
|
49 | 49 | echo " ! ! ! this is a tagged controller release ! ! !"
|
50 | 50 | TAG="${PULL_BASE_REF#controller/*}"
|
51 |
| - ADDITIONAL_CONTROLLER_TAGS+=("${CONTROLLER_IMAGE}:${TAG}") |
| 51 | + # when tagging a release image, do not apply any other tags other than the release tag |
| 52 | + # the registry.k8s.io scripting does not handle images with multiple tags |
| 53 | + ADDITIONAL_CONTROLLER_TAGS=() |
| 54 | + CONTROLLER_TAG="${CONTROLLER_IMAGE}:${TAG}" |
52 | 55 | fi
|
53 | 56 |
|
54 | 57 | # PULL_BASE_REF is 'sidecar/TAG' for a tagged sidecar release
|
55 | 58 | if [[ "${PULL_BASE_REF}" == sidecar/* ]]; then
|
56 | 59 | echo " ! ! ! this is a tagged sidecar release ! ! !"
|
57 | 60 | TAG="${PULL_BASE_REF#sidecar/*}"
|
58 |
| - ADDITIONAL_SIDECAR_TAGS+=("${SIDECAR_IMAGE}:${TAG}") |
| 61 | + # when tagging a release image, do not apply any other tags other than the release tag |
| 62 | + # the registry.k8s.io scripting does not handle images with multiple tags |
| 63 | + ADDITIONAL_SIDECAR_TAGS=() |
| 64 | + SIDECAR_TAG="${SIDECAR_IMAGE}:${TAG}" |
59 | 65 | fi
|
60 | 66 |
|
61 | 67 | # PULL_BASE_REF is 'v0.y.z*' for tagged alpha releases where controller and sidecar are released simultaneously
|
62 | 68 | # hand wave over complex matching logic by just looking for 'v0.' prefix
|
63 | 69 | if [[ "${PULL_BASE_REF}" == 'v0.'* ]]; then
|
64 | 70 | echo " ! ! ! this is a tagged controller + sidecar release ! ! !"
|
65 | 71 | TAG="${PULL_BASE_REF}"
|
66 |
| - ADDITIONAL_CONTROLLER_TAGS+=("${CONTROLLER_IMAGE}:${TAG}") |
67 |
| - ADDITIONAL_SIDECAR_TAGS+=("${SIDECAR_IMAGE}:${TAG}") |
| 72 | + # when tagging a release image, do not apply any other tags other than the release tag |
| 73 | + # the registry.k8s.io scripting does not handle images with multiple tags |
| 74 | + ADDITIONAL_CONTROLLER_TAGS=() |
| 75 | + ADDITIONAL_SIDECAR_TAGS=() |
| 76 | + CONTROLLER_TAG="${CONTROLLER_IMAGE}:${TAG}" |
| 77 | + SIDECAR_TAG="${SIDECAR_IMAGE}:${TAG}" |
68 | 78 | fi
|
69 | 79 |
|
70 | 80 | # else, PULL_BASE_REF is something that doesn't release image(s) to staging, like:
|
71 | 81 | # - a random branch name (e.g., feature-xyz)
|
72 | 82 | # - a version tag for a subdir with no image associated (e.g., client/v0.2.0, proto/v0.2.0)
|
73 | 83 |
|
74 |
| -# 'gcloud container images add-tag' within the cloudbuild infrastructure doesn't preserve the date |
75 |
| -# of the underlying image when adding a new tag, resulting in tags dated Dec 31, 1969 (the epoch). |
76 |
| -# To ensure the right date on all built image tags, do the build with '--tag' args for all tags. |
| 84 | +# This script's tagging should be less error-prone if 'docker buildx' has all the tags that an image |
| 85 | +# will be tagged with during the build process. All tags are applied at once without need to |
| 86 | +# maintain tooling for adding tags to manifests after build. |
77 | 87 |
|
78 | 88 | BUILD_ARGS="${ADDITIONAL_BUILD_ARGS}"
|
79 | 89 | for tag in "${ADDITIONAL_CONTROLLER_TAGS[@]}"; do
|
|
0 commit comments