Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate image dependency upgrades & Migrate to kubekins-e2e-v2 #2177

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!"
Loading