Skip to content

Commit

Permalink
Automate image dependency upgrades & Migrate to kubekins-e2e-v2 (#2177)
Browse files Browse the repository at this point in the history
* Automate kubekins-e2e-v2 & gcb-docker-build image updates

* Migrate to kubekins-e2e-v2 (v1 is deprecated)

* Update hack/release-scripts/update-e2e-images

Co-authored-by: ConnorJC <[email protected]>

---------

Co-authored-by: ConnorJC <[email protected]>
  • Loading branch information
AndrewSirenko and ConnorJC3 authored Oct 11, 2024
1 parent 1dbfba8 commit 38f0b20
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ generate-sidecar-tags: update-truth-sidecars charts/aws-ebs-csi-driver/values.ya
.PHONY: update-sidecar-dependencies
update-sidecar-dependencies: update-truth-sidecars generate-sidecar-tags update/kustomize

.PHONY: update-image-dependencies
update-image-dependencies: update-sidecar-dependencies
./hack/release-scripts/update-e2e-images

## CI aliases
# Targets intended to be executed mostly or only by CI jobs

Expand Down
2 changes: 0 additions & 2 deletions charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ spec:
volumeMounts:
- name: config-vol
mountPath: /etc/config
# kubekins-e2e v1 image is linux amd64 only.
nodeSelector:
kubernetes.io/os: linux
kubernetes.io/arch: amd64
serviceAccountName: ebs-csi-driver-test
volumes:
- name: config-vol
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,4 @@ nodeComponentOnly: false
helmTester:
enabled: true
# Supply a custom image to the ebs-csi-driver-test pod in helm-tester.yaml
image: "gcr.io/k8s-staging-test-infra/kubekins-e2e:v20240903-6a352c5344-master"
image: "us-central1-docker.pkg.dev/k8s-staging-test-infra/images/kubekins-e2e:v20240903-6a352c5344-master"
6 changes: 5 additions & 1 deletion docs/makefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,13 @@ Test the EBS CSI Driver Helm chart via the [Helm `chart-testing` tool](https://g

## Release Scripts

### 'make update-image-dependencies'

Convenience target to perform all image updates (including sidecars, kubekins-e2e-v2, and gcb-docker-gcloud). This is the primary target to use unless more granular control is needed.

### `make update-sidecar-dependencies`

Convenience target to perform all sidecar updates and regenerate the manifests. This is the primary target to use unless more granular control is needed.
Convenience target to perform all sidecar updates and regenerate the manifests.

### `make update-truth-sidecars`

Expand Down
67 changes: 67 additions & 0 deletions hack/release-scripts/update-e2e-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# ---
# This script updates images used by aws-ebs-csi-driver CI

set -euo pipefail # Exit on any error

# --- Environment Variables
export KUBEKINS_IMAGE GCB_IMAGE

SCRIPT_PATH=$(dirname $(realpath "$0"))
ROOT_DIRECTORY="$SCRIPT_PATH/../.."

CLOUDBUILD_FILEPATH="$ROOT_DIRECTORY/cloudbuild.yaml"
HELM_VALUES_FILEPATH="$ROOT_DIRECTORY/charts/aws-ebs-csi-driver/values.yaml"

KUBEKINS_REPO="us-central1-docker.pkg.dev/k8s-staging-test-infra/images/kubekins-e2e"
GCB_REPO="gcr.io/k8s-staging-test-infra/gcb-docker-gcloud"

# --- Script Tools
log() {
printf "%s [INFO] - %s\n" "$(date +"%Y-%m-%d %H:%M:%S")" "${*}" >&2
}

check_dependencies() {
local readonly dependencies=("yq" "git" "crane")

for cmd in "${dependencies[@]}"; do
if ! command -v "${cmd}" &>/dev/null; then
log "${cmd} binary could not be found, please install it."
exit 1
fi
done
}

# --- Script

check_dependencies

log "Fetching latest kubekins-e2e-v2 image from $KUBEKINS_REPO"
KUBEKINS_TAG=$(crane ls "$KUBEKINS_REPO" | grep -E 'master$' | sort -V | tail -n 1)
export KUBEKINS_IMAGE="$KUBEKINS_REPO:$KUBEKINS_TAG"

log "Updating kubekins-e2e-v2 image in $HELM_VALUES_FILEPATH to $KUBEKINS_IMAGE"
yq ".helmTester.image = env(KUBEKINS_IMAGE)" -i "$HELM_VALUES_FILEPATH"

log "Fetching latest gcb-docker-gcloud image from $GCB_REPO"
GCB_TAG=$(crane ls "$GCB_REPO" | sort -V | tail -n 1)
export GCB_IMAGE="$GCB_REPO:$GCB_TAG"

log "Updating gcb-docker-gcloud image in $CLOUDBUILD_FILEPATH to $GCB_IMAGE"
yq ".steps[0].name = env(GCB_IMAGE)" -i "$CLOUDBUILD_FILEPATH"

log "Success! Updated kubekins-e2e-v2 and gcb-docker-gcloud images!"

0 comments on commit 38f0b20

Please sign in to comment.