From c3ca8c736ef223efb4b2a56e5dcf76adad7f2b6f Mon Sep 17 00:00:00 2001 From: KFilippopolitis Date: Mon, 2 Nov 2026 11:41:09 +0200 Subject: [PATCH 1/2] Add staging image publish + bump workflow Builds and pushes platform-ui to Docker Hub on push to staging-a/staging-b and reuses the mip bump workflow to deploy into the matching federation. Co-authored-by: Cursor --- .github/workflows/publish_staging_images.yml | 92 ++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/publish_staging_images.yml diff --git a/.github/workflows/publish_staging_images.yml b/.github/workflows/publish_staging_images.yml new file mode 100644 index 000000000..c77be29a2 --- /dev/null +++ b/.github/workflows/publish_staging_images.yml @@ -0,0 +1,92 @@ +name: Publish staging images + +on: + push: + branches: [staging-a, staging-b] + workflow_dispatch: + +concurrency: staging-${{ github.ref_name }} + +permissions: + contents: read + +env: + HARBOR_REGISTRY: docker-registry.ebrains.eu + DOCKER_BUILDKIT: 1 + DOCKER_CLIENT_TIMEOUT: 300 + COMPOSE_HTTP_TIMEOUT: 300 + RETRY_ATTEMPTS: "4" + RETRY_SLEEP: "10" + +jobs: + build: + name: Build PLATFORM-UI staging image and push to Docker Hub + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.tag }} + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 #v4.4.1 + + - name: Harbor connectivity probe + run: | + set -x + getent hosts ${{ env.HARBOR_REGISTRY }} || true + curl -vI --connect-timeout 10 https://${{ env.HARBOR_REGISTRY }}/v2/ || true + + - name: Disable IPv6 (job-scoped) + run: | + sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 + sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 + + - name: Log in to Docker Hub + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f #v4.6.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Load PLATFORM-UI service cached image + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 + with: + path: /tmp/.buildx-cache/platform-ui + key: ${{ runner.os }}-buildx-platform-ui-${{ hashFiles('Dockerfile', 'nginx.conf.template', 'package.json', 'package-lock.json', 'angular.json', 'src/**', 'public/**') }} + restore-keys: | + ${{ runner.os }}-buildx-platform-ui- + + - name: Build PLATFORM-UI docker image + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc #v7.4.0 + with: + context: . + file: ./Dockerfile + push: true + tags: hbpmip/platform-ui:${{ github.ref_name }}-${{ github.sha:0:7 }} + cache-from: type=local,src=/tmp/.buildx-cache/platform-ui + cache-to: type=local,dest=/tmp/.buildx-cache-new/platform-ui + + - name: Move Docker images cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + - name: Output staging tag + id: tag + run: | + echo "tag=${{ github.ref_name }}-${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT" + echo "Staging image tag: ${{ github.ref_name }}-${GITHUB_SHA:0:7}" + + bump: + name: Bump staging image tag in mip + needs: build + uses: Medical-Informatics-Platform/mip/.github/workflows/bump-staging-image.yml@master + permissions: + contents: read + with: + branch: ${{ github.ref_name }} + key: platform-ui.image.tag + tag: ${{ needs.build.outputs.tag }} + secrets: + app-id: ${{ secrets.STAGING_BUMP_APP_ID }} + private-key: ${{ secrets.STAGING_BUMP_APP_PRIVATE_KEY }} From 4473d2a769d192f9381da1d20be197c5d00f1aef Mon Sep 17 00:00:00 2001 From: KFilippopolitis Date: Mon, 2 Nov 2026 11:54:21 +0200 Subject: [PATCH 2/2] Fix run-shell-injection code-scanning findings Route github context data through env vars in the Output staging tag step instead of interpolating ${{ github.* }} directly into the run script. Co-authored-by: Cursor --- .github/workflows/publish_staging_images.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_staging_images.yml b/.github/workflows/publish_staging_images.yml index c77be29a2..3614da371 100644 --- a/.github/workflows/publish_staging_images.yml +++ b/.github/workflows/publish_staging_images.yml @@ -73,9 +73,12 @@ jobs: - name: Output staging tag id: tag + env: + REF_NAME: ${{ github.ref_name }} + SHORT_SHA: ${{ github.sha:0:7 }} run: | - echo "tag=${{ github.ref_name }}-${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT" - echo "Staging image tag: ${{ github.ref_name }}-${GITHUB_SHA:0:7}" + echo "tag=${REF_NAME}-${SHORT_SHA}" >> "$GITHUB_OUTPUT" + echo "Staging image tag: ${REF_NAME}-${SHORT_SHA}" bump: name: Bump staging image tag in mip