From 3b7cbf7f6d20115159002da67ca657f7f5e99096 Mon Sep 17 00:00:00 2001 From: Nikola Simsic Date: Fri, 6 Sep 2024 14:48:18 +0200 Subject: [PATCH] Adding config for custom SP version download --- .github/scripts/mxbuild.Dockerfile | 10 ++++++++-- .github/workflows/NativePipeline.yml | 29 +++++++++++++++++----------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/scripts/mxbuild.Dockerfile b/.github/scripts/mxbuild.Dockerfile index 49d751b81..705d85286 100644 --- a/.github/scripts/mxbuild.Dockerfile +++ b/.github/scripts/mxbuild.Dockerfile @@ -1,5 +1,6 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0 ARG MENDIX_VERSION +ARG MENDIX_VERSION_URL RUN \ echo "Installing Java..." && \ @@ -10,8 +11,13 @@ RUN \ tar xfz /tmp/openjdk.tar.gz --directory /usr/lib/jvm && \ rm /tmp/openjdk.tar.gz RUN \ - echo "Downloading mxbuild ${MENDIX_VERSION}..." && \ - wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mxbuild.tar.gz && \ + if [ -z "$MENDIX_VERSION_URL" ]; then \ + echo "Downloading mxbuild ${MENDIX_VERSION}..." && \ + wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mbuild.tar.gz; \ + else \ + echo "Downloading mxbuild from provided URL..." && \ + wget -q $MENDIX_VERSION_URL -O /tmp/mbuild.tar.gz; \ + fi && \ mkdir /tmp/mxbuild && \ tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild && \ rm /tmp/mxbuild.tar.gz diff --git a/.github/workflows/NativePipeline.yml b/.github/workflows/NativePipeline.yml index 31d4f1703..b6f485c81 100644 --- a/.github/workflows/NativePipeline.yml +++ b/.github/workflows/NativePipeline.yml @@ -2,6 +2,11 @@ name: Run Native Pipeline on: workflow_dispatch: inputs: + mendix_version_url: + description: "Provide the url of SP to be used in job (Full path to mxbuild.tar.gz)" + required: false + default: "" + nt_branch: description: "Native Template branch to use (default: master)" default: "master" @@ -54,12 +59,6 @@ on: - video-player-native - web-view-native - # schedule: - # - cron: "0 6 * * *" - - # push: - # branches: [master] - pull_request: # branches: [master] @@ -97,17 +96,24 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: "Get Mendix version" id: get-mendix-version + if: ${{ github.event.inputs.mendix_version_url == '' }} uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 # v0.2.0 with: path: configs/e2e/mendix-versions.json prop_path: latest - outputs: - mendix-version: ${{ steps.get-mendix-version.outputs.prop }} + + - name: Use provided mx version + id: use-provided-mx-version + run: | + if [[ -z "${{ github.event.inputs.mendix_version_url }}" ]]; then + echo "MENDIX_VERSION=${{ steps.get-mendix-version.outputs.prop }}" >> $GITHUB_ENV + else + echo "MENDIX_VERSION_URL=${{ github.event.inputs.mendix_version_url }}" >> $GITHUB_ENV + fi + docker-images: needs: mendix-version runs-on: ubuntu-22.04 - env: - MENDIX_VERSION: ${{ needs.mendix-version.outputs.mendix-version }} steps: - name: "Login to GitHub Container Registry" uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 @@ -117,7 +123,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: "Check if docker image already exists" run: | - docker manifest inspect ghcr.io/mendix/native-widgets/mxbuild:${{ env.MENDIX_VERSION }} || EXIT_CODE=$? + docker manifest inspect ghcr.io/m/native-widgets/mxbuild:${{ env.MENDIX_VERSION }} || EXIT_CODE=$? echo "IMAGE_MISSING=$EXIT_CODE" >> $GITHUB_ENV - name: "Check out code" uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 @@ -130,6 +136,7 @@ jobs: context: ./.github/scripts build-args: | MENDIX_VERSION=${{ env.MENDIX_VERSION }} + MENDIX_VERSION_URL=${{ env.MENDIX_VERSION_URL }} push: true tags: ghcr.io/mendix/native-widgets/mxbuild:${{ env.MENDIX_VERSION }} secrets: GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}