Skip to content

Commit 4d83dab

Browse files
committed
ci(emailsender): optimize compatibility test
1 parent 4e29d2f commit 4d83dab

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
- main
88
paths:
99
- 'emailsender/**'
10+
- 'deploy/charts/emailsender/**'
1011
- 'scripts/**'
1112
- '.github/workflows/emailsender-central-compatibility.yaml'
1213

1314
pull_request:
1415
types: [opened, synchronize, reopened, ready_for_review]
1516
paths:
1617
- 'emailsender/**'
18+
- 'deploy/charts/emailsender/**'
1719
- 'scripts/**'
1820
- '.github/workflows/emailsender-central-compatibility.yaml'
1921

@@ -54,13 +56,6 @@ jobs:
5456
with:
5557
path: acs-fleet-manager
5658
fetch-depth: 0
57-
- name: Checkout stackrox/stackrox repository
58-
uses: actions/checkout@v4
59-
with:
60-
repository: stackrox/stackrox
61-
path: stackrox
62-
fetch-tags: true
63-
fetch-depth: 0
6459
- name: Create Kind cluster"
6560
uses: helm/kind-action@v1
6661
with:

scripts/ci/central_compatibility/run_compatibility_test.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ set -eu
77
# 2. acs-fleet-manager repo to be available at the execution path with directory name acs-fleet-manager
88
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../.. && pwd)"
99
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10-
STACKROX_DIR="$(cd "$ROOT_DIR/../stackrox" && pwd)"
1110

1211
EMAILSENDER_NS="rhacs"
1312
CENTRAL_NS="rhacs-tenant"
@@ -48,13 +47,13 @@ log "Emailsender deployed to Kind."
4847
log "Starting to deploy central services..."
4948
# use nightly if GH action running for acs-fleet-manager
5049
# use the stackrox tag otherwise
50+
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-stackrox/acs-fleet-manager}
5151
log "Running for repository: $GITHUB_REPOSITORY"
5252
if [ "$GITHUB_REPOSITORY" = "stackrox/stackrox" ]; then
53+
STACKROX_DIR="$(cd "$ROOT_DIR/../stackrox" && pwd)"
5354
ACS_VERSION="$(make --no-print-directory -C "$STACKROX_DIR" tag)"
5455
else
55-
git -C "$STACKROX_DIR" fetch --tags
56-
ACS_VERSION="$(git -C "$STACKROX_DIR" tag | grep -E '.*-nightly-[0-9]{8}$' | tail -n 1)"
57-
git -C "$STACKROX_DIR" checkout "$ACS_VERSION"
56+
ACS_VERSION="$(git ls-remote --tags https://github.com/stackrox/stackrox | grep -E '.*-nightly-[0-9]{8}$' | tail -n 1 | awk '{print $2}' | sed 's|refs/tags/||')"
5857
fi
5958

6059
log "ACS version: $ACS_VERSION"
@@ -74,13 +73,9 @@ for img in "${IMAGES_TO_PULL[@]}"; do
7473
pull_to_kind "$img"
7574
done
7675

77-
TAG="$ACS_VERSION" make --no-print-directory -C "$STACKROX_DIR" cli_host-arch
78-
GOARCH="$(go env GOARCH)"
79-
GOOS="$(go env GOOS)"
80-
81-
ROXCTL="$STACKROX_DIR/bin/${GOOS}_${GOARCH}/roxctl"
76+
ROXCTL="docker run --rm --user $(id -u):$(id -g) -v $(pwd):/tmp/stackrox-charts/ $MAIN_IMAGE:$ACS_VERSION"
8277
# --remove to make this script rerunnable on a local machine
83-
$ROXCTL helm output central-services --remove --output-dir ./central-chart
78+
$ROXCTL helm output central-services --remove --output-dir /tmp/stackrox-charts/central-chart
8479

8580
# Using ACS_VERSION explicitly here since it would otherwise not use the nightly build tag
8681
helm upgrade --install -n $CENTRAL_NS stackrox-central-services ./central-chart \

0 commit comments

Comments
 (0)