Skip to content

Commit 30c1087

Browse files
committed
fix: corrected copilot comments
1 parent 70b00b3 commit 30c1087

1 file changed

Lines changed: 53 additions & 20 deletions

File tree

.github/workflows/build-and-test-qa.yml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,56 @@ env:
3838
QA_IMAGES: "registry.camunda.cloud/team-cambpm/weblogic14r1 registry.camunda.cloud/team-cambpm/weblogic14r12"
3939

4040
jobs:
41+
# Single source of truth: normalize the dispatch inputs ONCE so the build job and the
42+
# manifest job can never disagree on the artifact version or the image tag names.
43+
# Accepts either "7.24.1 + snapshot=true" or "7.24.1-SNAPSHOT" and produces identical outputs.
44+
prepare:
45+
runs-on: ubuntu-22.04
46+
outputs:
47+
version: ${{ steps.norm.outputs.version }} # canonical version, no suffix (e.g. 7.24.1)
48+
snapshot: ${{ steps.norm.outputs.snapshot }} # "true" | "false"
49+
suffix: ${{ steps.norm.outputs.suffix }} # "SNAPSHOT" | "ee"
50+
version_tag: ${{ steps.norm.outputs.version_tag }} # <version>-<suffix> (e.g. 7.24.1-ee)
51+
latest_tag: ${{ steps.norm.outputs.latest_tag }} # <major>-latest (e.g. 7.24-latest)
52+
ee_branch: ${{ steps.norm.outputs.ee_branch }} # qa/docker source branch (e.g. 7.24)
53+
steps:
54+
- name: Normalize version & snapshot
55+
id: norm
56+
run: |
57+
set -euo pipefail
58+
if [ -z "${RAW_VERSION}" ]; then
59+
echo "version input must not be empty" >&2; exit 1
60+
fi
61+
SNAPSHOT="${RAW_SNAPSHOT:-false}"
62+
# A "-SNAPSHOT" (or "-ee") suffix on the version is authoritative and implies the flag.
63+
case "${RAW_VERSION}" in
64+
*-SNAPSHOT) SNAPSHOT=true ;;
65+
esac
66+
VERSION="${RAW_VERSION%-SNAPSHOT}"
67+
VERSION="${VERSION%-ee}"
68+
if [ "${SNAPSHOT}" = "true" ]; then SUFFIX=SNAPSHOT; else SUFFIX=ee; fi
69+
MAJOR="$(echo "${VERSION}" | cut -d. -f1,2)" # 7.24.1 -> 7.24
70+
{
71+
echo "version=${VERSION}"
72+
echo "snapshot=${SNAPSHOT}"
73+
echo "suffix=${SUFFIX}"
74+
echo "version_tag=${VERSION}-${SUFFIX}"
75+
echo "latest_tag=${MAJOR}-latest"
76+
echo "ee_branch=${MAJOR}"
77+
} >> "$GITHUB_OUTPUT"
78+
env:
79+
RAW_VERSION: ${{ github.event.inputs.version }}
80+
RAW_SNAPSHOT: ${{ github.event.inputs.snapshot }}
81+
4182
build-and-test-qa:
83+
needs: prepare
4284
runs-on: ${{ matrix.RUNNER }}
4385
strategy:
4486
fail-fast: false
4587
matrix:
4688
RUNNER: [ubuntu-22.04, aws-arm-core-4-default]
4789
steps:
48-
- name: Resolve architecture & EE branch
90+
- name: Resolve runner architecture
4991
id: ctx
5092
run: |
5193
case "$(uname -m)" in
@@ -54,10 +96,6 @@ jobs:
5496
*) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;;
5597
esac
5698
echo "ARCH=${ARCH}" >> "$GITHUB_OUTPUT"
57-
# 7.24.1 -> 7.24 ; 7.24.0-SNAPSHOT -> 7.24
58-
echo "EE_BRANCH=$(echo "${VERSION}" | cut -d. -f1,2)" >> "$GITHUB_OUTPUT"
59-
env:
60-
VERSION: ${{ github.event.inputs.version }}
6199
62100
- name: Import Secrets
63101
id: secrets
@@ -88,7 +126,7 @@ jobs:
88126
uses: actions/checkout@v4
89127
with:
90128
repository: ${{ env.EE_REPO }}
91-
ref: ${{ steps.ctx.outputs.EE_BRANCH }}
129+
ref: ${{ needs.prepare.outputs.ee_branch }}
92130
token: ${{ steps.app-token.outputs.token }}
93131
path: platform-ee
94132

@@ -106,7 +144,6 @@ jobs:
106144
username: ${{ steps.secrets.outputs.HARBOR_USERNAME }}
107145
password: ${{ steps.secrets.outputs.HARBOR_PASSWORD }}
108146

109-
110147
# Nexus-authenticated settings.xml (resolves org.camunda.bpm.weblogic:camunda-bpm-weblogic).
111148
# Maven interpolates ${env.NEXUS_USR/PSW} at runtime, so no secret is written to disk.
112149
- name: Generate Maven settings.xml
@@ -127,24 +164,22 @@ jobs:
127164
working-directory: platform-ee
128165
run: |
129166
set -euo pipefail
130-
if [ "${SNAPSHOT}" = "true" ]; then SUFFIX=SNAPSHOT; else SUFFIX=ee; fi
131-
SRC_TAG="${VERSION}-${SUFFIX}-${ARCH}"
132-
echo "Building native ${ARCH} QA images, source tag suffix: ${SRC_TAG}"
167+
SRC_TAG="${VERSION_TAG}-${ARCH}" # e.g. 7.24.1-ee-amd64
168+
echo "Building native ${ARCH} QA images, source tag: ${SRC_TAG}"
133169
./mvnw -s "${RUNNER_TEMP}/settings.xml" -B -f qa/docker/pom.xml clean install \
134170
-Pbuild-docker-qa \
135-
-Dversion.camunda-bpm="${VERSION}-${SUFFIX}" \
171+
-Dversion.camunda-bpm="${VERSION_TAG}" \
136172
-Dqa.docker.primaryTag="${SRC_TAG}" \
137173
-Dqa.docker.secondaryTag="${SRC_TAG}" \
138174
-Ddocker.skip.push=false
139175
env:
140-
VERSION: ${{ github.event.inputs.version }}
141-
SNAPSHOT: ${{ github.event.inputs.snapshot }}
176+
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
142177
ARCH: ${{ steps.ctx.outputs.ARCH }}
143178
NEXUS_USR: ${{ steps.secrets.outputs.NEXUS_USER }}
144179
NEXUS_PSW: ${{ steps.secrets.outputs.NEXUS_PASS }}
145180

146181
create-manifests-qa:
147-
needs: build-and-test-qa
182+
needs: [prepare, build-and-test-qa]
148183
runs-on: ubuntu-22.04
149184
steps:
150185
- name: Import Secrets
@@ -170,10 +205,8 @@ jobs:
170205
- name: Create multi-arch manifests
171206
run: |
172207
set -euo pipefail
173-
if [ "${SNAPSHOT}" = "true" ]; then SUFFIX=SNAPSHOT; else SUFFIX=ee; fi
174-
VERSION_TAG="${VERSION}-${SUFFIX}" # e.g. 7.24.1-ee
175-
MAJOR="$(echo "${VERSION}" | cut -d. -f1,2)"
176-
LATEST_TAG="${MAJOR}-latest" # e.g. 7.24-latest (consumed by Portainer)
208+
# VERSION_TAG / LATEST_TAG come from the shared `prepare` job, so they are guaranteed
209+
# to match the per-arch source tags pushed by build-and-test-qa.
177210
for image in ${QA_IMAGES}; do
178211
echo "::group::Manifest ${image}:${VERSION_TAG} / :${LATEST_TAG}"
179212
docker buildx imagetools create \
@@ -191,6 +224,6 @@ jobs:
191224
fi
192225
done
193226
env:
194-
VERSION: ${{ github.event.inputs.version }}
195-
SNAPSHOT: ${{ github.event.inputs.snapshot }}
227+
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
228+
LATEST_TAG: ${{ needs.prepare.outputs.latest_tag }}
196229

0 commit comments

Comments
 (0)