Skip to content

Commit 626e8d8

Browse files
committed
Fix multicluster E2E tests
1 parent 2b90977 commit 626e8d8

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/multicluster-e2e.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,24 @@ jobs:
3333
strategy:
3434
matrix:
3535
name: [acscs1, acscs2]
36+
outputs:
37+
cluster_id: ${{ steps.cluster_id.outputs.short_sha }}
3638
steps:
39+
- name: Generate cluster ID
40+
id: cluster_id
41+
run: |
42+
# OSD cluster names are limited to 15 characters.
43+
# Use first 7 chars of commit SHA for traceability and uniqueness.
44+
# Format: <prefix>-<7-char-sha> (e.g., acscs1-a1b2c3d = 14 chars)
45+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
46+
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
47+
3748
- name: Create cluster
3849
uses: stackrox/actions/infra/create-cluster@v1
3950
with:
4051
token: ${{ secrets.INFRA_TOKEN }}
4152
flavor: osd-on-aws
42-
name: ${{ matrix.name }}-${{ github.run_id }}${{ github.run_attempt }}
53+
name: ${{ matrix.name }}-${{ steps.cluster_id.outputs.short_sha }}
4354
lifespan: 3h
4455
args: nodes=3,machine-type=m5.2xlarge
4556
wait: true
@@ -66,13 +77,14 @@ jobs:
6677
- name: Set cluster credentials
6778
run: |
6879
set -eo pipefail
80+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
6981
mkdir kube
7082
cluster1Conf="$(pwd)/kube/cluster1"
71-
url=$(infractl artifacts "acscs1-${{ github.run_id }}${{ github.run_attempt }}" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
83+
url=$(infractl artifacts "acscs1-${SHORT_SHA}" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
7284
wget -O "$cluster1Conf" "$url"
7385
7486
cluster2Conf="$(pwd)/kube/cluster2"
75-
url=$(infractl artifacts "acscs2-${{ github.run_id }}${{ github.run_attempt }}" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
87+
url=$(infractl artifacts "acscs2-${SHORT_SHA}" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
7688
wget -O "$cluster2Conf" "$url"
7789
7890
echo "CLUSTER_1_KUBECONFIG=$cluster1Conf" >> "$GITHUB_ENV"
@@ -112,6 +124,7 @@ jobs:
112124
- name: Delete test clusters
113125
run: |
114126
set -o pipefail
115-
infractl delete "acscs1-${{ github.run_id }}${{ github.run_attempt }}"
116-
infractl delete "acscs2-${{ github.run_id }}${{ github.run_attempt }}"
127+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
128+
infractl delete "acscs1-${SHORT_SHA}"
129+
infractl delete "acscs2-${SHORT_SHA}"
117130
exit 0

0 commit comments

Comments
 (0)