Skip to content

Commit 4a7b3b6

Browse files
authored
fix: workaround for emailsender kind image load (#2577)
* try workaround for kind image load * fix main img * fix img names * save tars in tmp dir * save tars in tmp dir * fix tmp reference
1 parent 8ebcb37 commit 4a7b3b6

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

.github/workflows/emailsender-central-compatibility.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
- 'deploy/charts/emailsender/**'
1818
- 'scripts/**'
1919
- '.github/workflows/emailsender-central-compatibility.yaml'
20+
concurrency:
21+
group: ${{ github.workflow }}
22+
cancel-in-progress: true
2023

2124
jobs:
2225
e2e-test-on-kind:
@@ -29,10 +32,6 @@ jobs:
2932
contents: read
3033
environment: development
3134
steps:
32-
- name: Cancel Previous Runs
33-
uses: n1hility/cancel-previous-runs@v3
34-
with:
35-
token: ${{ secrets.GITHUB_TOKEN }}
3635
- name: Set up Go
3736
uses: actions/setup-go@v6
3837
with:
@@ -55,7 +54,7 @@ jobs:
5554
with:
5655
path: acs-fleet-manager
5756
fetch-depth: 0
58-
- name: Create Kind cluster"
57+
- name: Create Kind cluster
5958
uses: helm/kind-action@v1
6059
with:
6160
cluster_name: kind

scripts/ci/central_compatibility/run_compatibility_test.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ source "$ROOT_DIR/dev/env/scripts/lib.sh"
2020

2121
function pull_to_kind() {
2222
local img=$1
23-
local retry="${2:-5}"
23+
local imgname=$2
24+
local retry="${3:-5}"
2425
local backoff=30
2526

2627
for _ in $(seq "$retry"); do
@@ -31,11 +32,17 @@ function pull_to_kind() {
3132
sleep "$backoff"
3233
done
3334

34-
kind load docker-image "${img}"
35+
docker save --platform amd64 "$img" -o "$IMG_TAR_DIR/$imgname.tar"
36+
kind load image-archive "$IMG_TAR_DIR/$imgname.tar"
3537
}
3638

3739
make --no-print-directory -C "$ROOT_DIR" image/build/emailsender
38-
kind load docker-image "$(make --no-print-directory -C "$ROOT_DIR" image-tag/emailsender)"
40+
41+
IMG_TAR_DIR="$(mktemp -d)"
42+
43+
EMAILSENDER_IMAGE="$(make --silent --no-print-directory -C "$ROOT_DIR" image-tag/emailsender)"
44+
docker save --platform amd64 "$EMAILSENDER_IMAGE" -o "$IMG_TAR_DIR/emailsender.tar"
45+
kind load image-archive "$IMG_TAR_DIR/emailsender.tar"
3946

4047
kubectl create ns $EMAILSENDER_NS -o yaml --dry-run=client | kubectl apply -f -
4148
kubectl create ns $CENTRAL_NS -o yaml --dry-run=client | kubectl apply -f -
@@ -51,29 +58,26 @@ GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-stackrox/acs-fleet-manager}
5158
log "Running for repository: $GITHUB_REPOSITORY"
5259
if [ "$GITHUB_REPOSITORY" = "stackrox/stackrox" ]; then
5360
STACKROX_DIR="$(cd "$ROOT_DIR/../stackrox" && pwd)"
54-
ACS_VERSION="$(make --no-print-directory -C "$STACKROX_DIR" tag)"
61+
ACS_VERSION="$(make --silent --no-print-directory -C "$STACKROX_DIR" tag)"
5562
else
5663
ACS_VERSION="$(git ls-remote --tags https://github.com/stackrox/stackrox | grep -E '.*-nightly-[0-9]{8}$' | awk '{print $2}' | sed 's|refs/tags/||' | sort -V | tail -n 1)"
5764
fi
5865

5966
log "ACS version: $ACS_VERSION"
6067

6168
IMG_REPO="quay.io/rhacs-eng"
62-
MAIN_IMG_NAME="$IMG_REPO/main"
63-
CENTRAL_DB_IMG_NAME="$IMG_REPO/central-db"
64-
65-
IMAGES_TO_PULL=(
66-
"$MAIN_IMG_NAME:$ACS_VERSION"
67-
"$CENTRAL_DB_IMG_NAME:$ACS_VERSION"
69+
IMG_NAMES=(
70+
"main"
71+
"central-db"
6872
)
69-
73+
MAIN_IMG="$IMG_REPO/main:$ACS_VERSION"
7074
IMG_WAIT_TIMEOUT_SECONDS="${IMG_WAIT_TIMEOUT_SECONDS:-1200}"
71-
for img in "${IMAGES_TO_PULL[@]}"; do
72-
wait_for_img "$img" "$IMG_WAIT_TIMEOUT_SECONDS"
73-
pull_to_kind "$img"
75+
for imgname in "${IMG_NAMES[@]}"; do
76+
wait_for_img "$IMG_REPO/$imgname:$ACS_VERSION" "$IMG_WAIT_TIMEOUT_SECONDS"
77+
pull_to_kind "$IMG_REPO/$imgname:$ACS_VERSION" "$imgname"
7478
done
7579

76-
ROXCTL="docker run --rm --user $(id -u):$(id -g) -v $(pwd):/tmp/stackrox-charts/ $MAIN_IMG_NAME:$ACS_VERSION"
80+
ROXCTL="docker run --rm --user $(id -u):$(id -g) -v $(pwd):/tmp/stackrox-charts/ $MAIN_IMG"
7781
# --remove to make this script rerunnable on a local machine
7882
$ROXCTL helm output central-services --image-defaults opensource --remove --output-dir /tmp/stackrox-charts/central-chart
7983

0 commit comments

Comments
 (0)