Skip to content
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
9 changes: 4 additions & 5 deletions .github/workflows/emailsender-central-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
- 'deploy/charts/emailsender/**'
- 'scripts/**'
- '.github/workflows/emailsender-central-compatibility.yaml'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
e2e-test-on-kind:
Expand All @@ -29,10 +32,6 @@ jobs:
contents: read
environment: development
steps:
- name: Cancel Previous Runs
uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v6
with:
Expand All @@ -55,7 +54,7 @@ jobs:
with:
path: acs-fleet-manager
fetch-depth: 0
- name: Create Kind cluster"
- name: Create Kind cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
Expand Down
34 changes: 19 additions & 15 deletions scripts/ci/central_compatibility/run_compatibility_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ source "$ROOT_DIR/dev/env/scripts/lib.sh"

function pull_to_kind() {
local img=$1
local retry="${2:-5}"
local imgname=$2
local retry="${3:-5}"
local backoff=30

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

kind load docker-image "${img}"
docker save --platform amd64 "$img" -o "$IMG_TAR_DIR/$imgname.tar"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 great!

kind load image-archive "$IMG_TAR_DIR/$imgname.tar"
}

make --no-print-directory -C "$ROOT_DIR" image/build/emailsender
kind load docker-image "$(make --no-print-directory -C "$ROOT_DIR" image-tag/emailsender)"

IMG_TAR_DIR="$(mktemp -d)"

EMAILSENDER_IMAGE="$(make --silent --no-print-directory -C "$ROOT_DIR" image-tag/emailsender)"
docker save --platform amd64 "$EMAILSENDER_IMAGE" -o "$IMG_TAR_DIR/emailsender.tar"
kind load image-archive "$IMG_TAR_DIR/emailsender.tar"

kubectl create ns $EMAILSENDER_NS -o yaml --dry-run=client | kubectl apply -f -
kubectl create ns $CENTRAL_NS -o yaml --dry-run=client | kubectl apply -f -
Expand All @@ -51,29 +58,26 @@ GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-stackrox/acs-fleet-manager}
log "Running for repository: $GITHUB_REPOSITORY"
if [ "$GITHUB_REPOSITORY" = "stackrox/stackrox" ]; then
STACKROX_DIR="$(cd "$ROOT_DIR/../stackrox" && pwd)"
ACS_VERSION="$(make --no-print-directory -C "$STACKROX_DIR" tag)"
ACS_VERSION="$(make --silent --no-print-directory -C "$STACKROX_DIR" tag)"
else
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)"
fi

log "ACS version: $ACS_VERSION"

IMG_REPO="quay.io/rhacs-eng"
MAIN_IMG_NAME="$IMG_REPO/main"
CENTRAL_DB_IMG_NAME="$IMG_REPO/central-db"

IMAGES_TO_PULL=(
"$MAIN_IMG_NAME:$ACS_VERSION"
"$CENTRAL_DB_IMG_NAME:$ACS_VERSION"
IMG_NAMES=(
"main"
"central-db"
)

MAIN_IMG="$IMG_REPO/main:$ACS_VERSION"
IMG_WAIT_TIMEOUT_SECONDS="${IMG_WAIT_TIMEOUT_SECONDS:-1200}"
for img in "${IMAGES_TO_PULL[@]}"; do
wait_for_img "$img" "$IMG_WAIT_TIMEOUT_SECONDS"
pull_to_kind "$img"
for imgname in "${IMG_NAMES[@]}"; do
wait_for_img "$IMG_REPO/$imgname:$ACS_VERSION" "$IMG_WAIT_TIMEOUT_SECONDS"
pull_to_kind "$IMG_REPO/$imgname:$ACS_VERSION" "$imgname"
done

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

Expand Down
Loading