Skip to content

Commit 2ae5bef

Browse files
CHEF-33431: delegate platform-ui docker build to build-docker.sh (#59)
* Add support for NPM Azure Key in Docker build for platform-ui Signed-off-by: Vaibhav Gadre <vgadre@progress.com> * update common workflow for testing Signed-off-by: Vaibhav Gadre <vgadre@progress.com> * Add NPM Azure Key support for platform-ui Docker build and update workflow reference Signed-off-by: Vaibhav Gadre <vgadre@progress.com> * CHEF-33431: delegate platform-ui docker build to build-docker.sh Replace inline Strategy 0 docker build block with a call to the repo's own build-docker.sh script. The script is now fully self-contained: - Submodule checkout using GITHUB_TOKEN - NPM_AZURE_KEY written to .npmrc.tmp as a BuildKit secret - docker buildx build --load, tagged platform-ui:local Removes the need to duplicate npm secret / submodule logic in the common workflow. Only GITHUB_TOKEN, NPM_AZURE_KEY, BRANCH_NAME, GIT_SHA, APP_VERSION and LOCALES are passed as env vars to the script. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * CHEF-33431: add platform-ui Strategy 0 to wiz.yml Add Strategy 0 identical to grype.yml and build-docker-image.yml so platform-ui docker build delegates to build-docker.sh for Wiz scans. Handles submodule checkout, NPM_AZURE_KEY secret, and docker buildx build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * CHEF-33431: remove RUN_ID from build-docker-image.yml Strategy 0 GitHub-hosted runners are ephemeral — no shared Docker daemon between jobs, so platform-ui:local tag is sufficient and unique per run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * reverting testing changes Signed-off-by: Vaibhav Gadre <vgadre@progress.com> * CHEF-33431: detect platform-ui image dynamically after build-docker.sh Replace hardcoded IMAGES="platform-ui:local" with the same dynamic grep used by Strategy 1 — detects whatever tag build-docker.sh actually produced. This decouples the workflow from the script's tag name and works correctly regardless of branch, PR, push to main, or release. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * testing changes Signed-off-by: Vaibhav Gadre <vgadre@progress.com> * reverting testing changes Signed-off-by: Vaibhav Gadre <vgadre@progress.com> --------- Signed-off-by: Vaibhav Gadre <vgadre@progress.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1fb28c4 commit 2ae5bef

3 files changed

Lines changed: 45 additions & 3 deletions

File tree

.github/workflows/build-docker-image.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,22 @@ jobs:
6868
echo "Building Docker image..."
6969
REPO_NAME=$(basename $(pwd))
7070
71+
# Strategy 0: platform-ui — delegate entirely to build-docker.sh which handles
72+
# submodule checkout (PAT), NPM Azure Key secret, and docker buildx build.
73+
if [ "${{ github.event.repository.name }}" = "platform-ui" ]; then
74+
echo "Detected platform-ui - delegating to build-docker.sh"
75+
chmod +x build-docker.sh
76+
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" \
77+
NPM_AZURE_KEY="${{ secrets.NPM_AZURE_KEY }}" \
78+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}" \
79+
GIT_SHA="${{ github.sha }}" \
80+
APP_VERSION="${{ github.ref_name }}" \
81+
LOCALES="en" \
82+
./build-docker.sh
83+
IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "^${REPO_NAME}" | grep -v "^<none>")
84+
7185
# Strategy 1: Check for build-docker.sh script (e.g., dsm-erchef)
72-
if [ -f "build-docker.sh" ]; then
86+
elif [ -f "build-docker.sh" ]; then
7387
echo "Found build-docker.sh script - using it to build images"
7488
chmod +x build-docker.sh
7589
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" ./build-docker.sh

.github/workflows/grype.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,22 @@ jobs:
106106
echo "Building Docker image..."
107107
REPO_NAME=$(basename $(pwd))
108108
109+
# Strategy 0: platform-ui — delegate entirely to build-docker.sh which handles
110+
# submodule checkout (PAT), NPM Azure Key secret, and docker buildx build.
111+
if [ "${{ github.event.repository.name }}" = "platform-ui" ]; then
112+
echo "Detected platform-ui - delegating to build-docker.sh"
113+
chmod +x build-docker.sh
114+
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" \
115+
NPM_AZURE_KEY="${{ secrets.NPM_AZURE_KEY }}" \
116+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}" \
117+
GIT_SHA="${{ github.sha }}" \
118+
APP_VERSION="${{ github.ref_name }}" \
119+
LOCALES="en" \
120+
./build-docker.sh
121+
IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "^${REPO_NAME}" | grep -v "^<none>")
122+
109123
# Strategy 1: Check for build-docker.sh script (e.g., dsm-erchef)
110-
if [ -f "build-docker.sh" ]; then
124+
elif [ -f "build-docker.sh" ]; then
111125
echo "Found build-docker.sh script - using it to build images"
112126
chmod +x build-docker.sh
113127
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" ./build-docker.sh

.github/workflows/wiz.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,22 @@ jobs:
107107
echo "Building Docker image..."
108108
REPO_NAME=$(basename $(pwd))
109109
110+
# Strategy 0: platform-ui — delegate entirely to build-docker.sh which handles
111+
# submodule checkout (GITHUB_TOKEN), NPM Azure Key secret, and docker buildx build.
112+
if [ "${{ github.event.repository.name }}" = "platform-ui" ]; then
113+
echo "Detected platform-ui - delegating to build-docker.sh"
114+
chmod +x build-docker.sh
115+
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" \
116+
NPM_AZURE_KEY="${{ secrets.NPM_AZURE_KEY }}" \
117+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}" \
118+
GIT_SHA="${{ github.sha }}" \
119+
APP_VERSION="${{ github.ref_name }}" \
120+
LOCALES="en" \
121+
./build-docker.sh
122+
IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "^${REPO_NAME}" | grep -v "^<none>")
123+
110124
# Strategy 1: Check for build-docker.sh script (e.g., dsm-erchef)
111-
if [ -f "build-docker.sh" ]; then
125+
elif [ -f "build-docker.sh" ]; then
112126
echo "Found build-docker.sh script - using it to build images"
113127
chmod +x build-docker.sh
114128
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" ./build-docker.sh

0 commit comments

Comments
 (0)