Skip to content

Commit cec8d3e

Browse files
author
Ray Wainman
committed
Add tag script for VPA to make release easier and less error-prone
1 parent fabcbe5 commit cec8d3e

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed

vertical-pod-autoscaler/RELEASE.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,15 @@ example `v20250430-cluster-autoscaler-chart-9.46.6-81-g6a6a912b4`.
7171
2. Set the `BUILD_TAG` variable to this tag in your shell:
7272

7373
```sh
74-
BUILD_TAG=<tag>
74+
export BUILD_TAG=<tag>
7575
```
7676

77-
3. Now tag this image with the latest version tag:
77+
3. Now tag this image with the latest version tag and run the script:
7878

7979
```sh
8080
cd vertical-pod-autoscaler/
81-
TAG=`grep 'const versionCore = ' common/version.go | cut -d '"' -f 2`
82-
echo "Adding tag $TAG based on built tag $BUILD_TAG"
83-
gcloud container images add-tag gcr.io/k8s-staging-autoscaling/vpa-admission-controller:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller:$TAG --project=k8s-staging-autoscaling
84-
gcloud container images add-tag gcr.io/k8s-staging-autoscaling/vpa-recommender:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender:$TAG --project=k8s-staging-autoscaling
85-
gcloud container images add-tag gcr.io/k8s-staging-autoscaling/vpa-updater:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater:$TAG --project=k8s-staging-autoscaling
81+
export TAG=`grep 'const versionCore = ' common/version.go | cut -d '"' -f 2`
82+
./hack/tag-release.sh
8683
```
8784

8885
### Option 2: Manual
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
# Convenience script that tags the VPA automatically built images with a
22+
# version tag in preparation for release.
23+
24+
# The following environment variables must be set for this script:
25+
# BUILD_TAG: corresponds to the tag of the automatic build (eg. v20250512-cluster-autoscaler-chart-9.46.6-151-g2b33c4c79)
26+
# TAG: corresponds to the version of the release (eg. 1.4.0)
27+
28+
# See VPA release instructions (in RELEASE.md) before using this file.
29+
30+
if [[ -z "$BUILD_TAG" ]]; then
31+
echo "BUILD_TAG must be set to the existing image build tag (eg. BUILD_TAG=v20250512-cluster-autoscaler-chart-9.46.6-151-g2b33c4c79)"
32+
exit 1
33+
fi
34+
if [[ -z "$TAG" ]]; then
35+
echo "TAG must be set to the VPA release number (eg. TAG=1.4.0)"
36+
exit 1
37+
fi
38+
39+
echo "Adding tag $TAG based on built tag $BUILD_TAG"
40+
41+
read -p "Press enter to continue"
42+
43+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller:$TAG --project=k8s-staging-autoscaling
44+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller-amd64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller-amd64:$TAG --project=k8s-staging-autoscaling
45+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller-arm:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller-arm:$TAG --project=k8s-staging-autoscaling
46+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller-arm64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller-arm64:$TAG --project=k8s-staging-autoscaling
47+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller-ppc64le:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller-ppc64le:$TAG --project=k8s-staging-autoscaling
48+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-admission-controller-s390x:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-admission-controller-s390x:$TAG --project=k8s-staging-autoscaling
49+
50+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender:$TAG --project=k8s-staging-autoscaling
51+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64:$TAG --project=k8s-staging-autoscaling
52+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender-arm:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender-arm:$TAG --project=k8s-staging-autoscaling
53+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender-arm64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender-arm64:$TAG --project=k8s-staging-autoscaling
54+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender-ppc64le:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender-ppc64le:$TAG --project=k8s-staging-autoscaling
55+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-recommender-s390x:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-recommender-s390x:$TAG --project=k8s-staging-autoscaling
56+
57+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater:$TAG --project=k8s-staging-autoscaling
58+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater-amd64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater-amd64:$TAG --project=k8s-staging-autoscaling
59+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater-arm:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater-arm:$TAG --project=k8s-staging-autoscaling
60+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater-arm64:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater-arm64:$TAG --project=k8s-staging-autoscaling
61+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater-ppc64le:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater-ppc64le:$TAG --project=k8s-staging-autoscaling
62+
gcloud container images add-tag -q gcr.io/k8s-staging-autoscaling/vpa-updater-s390x:$BUILD_TAG gcr.io/k8s-staging-autoscaling/vpa-updater-s390x:$TAG --project=k8s-staging-autoscaling

0 commit comments

Comments
 (0)