From 7d3b847c0db468c503dd170b686b784385b6764f Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Tue, 21 Jan 2025 14:17:29 +0000 Subject: [PATCH 01/18] added optional inputs for gateway URL --- .../manual-deploy-ten-gateway-frontend.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 59ff2e13f5..16796860bf 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -31,6 +31,17 @@ on: options: - "primary" - "dexynth" + gateway_url: + description: "Gateway URL" + required: false + build_tag: + description: "Docker Build Tag" + required: false + deploy: + description: "Deploy" + required: false + default: "true" + jobs: validate-inputs: runs-on: ubuntu-latest @@ -57,6 +68,8 @@ jobs: INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" fi + GATEWAY_URL="${{ github.event.inputs.GATEWAY_URL || env.GATEWAY_URL }}" + echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV @@ -129,7 +142,9 @@ jobs: -f ./tools/walletextension/frontend/Dockerfile . docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} + - name: 'Deploy Gateway FE to Azure Container Instances' + if: ${{ github.event.inputs.deploy == 'true' }} uses: "azure/aci-deploy@v1" with: resource-group: ${{ secrets.RESOURCE_GROUP }} From 976a0d80b9d85bf1365dddb121666a0b22646832 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Tue, 21 Jan 2025 16:48:03 +0000 Subject: [PATCH 02/18] added tag as input --- .../manual-deploy-ten-gateway-frontend.yml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 16796860bf..12290e6b4a 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -41,6 +41,10 @@ on: description: "Deploy" required: false default: "true" + tag: + description: 'Tag to build and push (leave empty for latest)' + required: true + default: '' jobs: validate-inputs: @@ -108,6 +112,18 @@ jobs: echo "GATEWAY_URL: $GATEWAY_URL" echo "NETWORK_NAME: $NETWORK_NAME" echo "TENSCAN_URL: $TENSCAN_URL" + - name: 'Get version' + id: get_version + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + elif [ -n "${{ github.event.inputs.tag }}" ]; then + echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + else + # Fetch the latest tag from the repository + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT + fi - uses: actions/checkout@v4 @@ -138,9 +154,9 @@ jobs: --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} \ + -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} + docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} - name: 'Deploy Gateway FE to Azure Container Instances' @@ -149,7 +165,7 @@ jobs: with: resource-group: ${{ secrets.RESOURCE_GROUP }} dns-name-label: ${{ env.DNS_NAME_LABEL_GATEWAY_FE }} - image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} + image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} name: ${{ env.IMAGE_NAME_GATEWAY_FE }} location: "uksouth" restart-policy: "Never" From 72b81c9f94220f0ae2c8c3674e76b811861d6b45 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:04:48 +0000 Subject: [PATCH 03/18] added new action to release gw FE image --- .../manual-deploy-ten-gateway-frontend.yml | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 12290e6b4a..59ff2e13f5 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -31,21 +31,6 @@ on: options: - "primary" - "dexynth" - gateway_url: - description: "Gateway URL" - required: false - build_tag: - description: "Docker Build Tag" - required: false - deploy: - description: "Deploy" - required: false - default: "true" - tag: - description: 'Tag to build and push (leave empty for latest)' - required: true - default: '' - jobs: validate-inputs: runs-on: ubuntu-latest @@ -72,8 +57,6 @@ jobs: INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" fi - GATEWAY_URL="${{ github.event.inputs.GATEWAY_URL || env.GATEWAY_URL }}" - echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV @@ -112,18 +95,6 @@ jobs: echo "GATEWAY_URL: $GATEWAY_URL" echo "NETWORK_NAME: $NETWORK_NAME" echo "TENSCAN_URL: $TENSCAN_URL" - - name: 'Get version' - id: get_version - run: | - if [ "${{ github.event_name }}" = "release" ]; then - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - elif [ -n "${{ github.event.inputs.tag }}" ]; then - echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT - else - # Fetch the latest tag from the repository - LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT - fi - uses: actions/checkout@v4 @@ -154,18 +125,16 @@ jobs: --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ + -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} - + docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} - name: 'Deploy Gateway FE to Azure Container Instances' - if: ${{ github.event.inputs.deploy == 'true' }} uses: "azure/aci-deploy@v1" with: resource-group: ${{ secrets.RESOURCE_GROUP }} dns-name-label: ${{ env.DNS_NAME_LABEL_GATEWAY_FE }} - image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} + image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} name: ${{ env.IMAGE_NAME_GATEWAY_FE }} location: "uksouth" restart-policy: "Never" From 7cf544d0fc4022495ee2998c2755d8f430eda85a Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:07:02 +0000 Subject: [PATCH 04/18] added new action to release gw FE image --- .../workflows/build-release-gw-fe-image.yml | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 .github/workflows/build-release-gw-fe-image.yml diff --git a/.github/workflows/build-release-gw-fe-image.yml b/.github/workflows/build-release-gw-fe-image.yml new file mode 100644 index 0000000000..9d9519ac5d --- /dev/null +++ b/.github/workflows/build-release-gw-fe-image.yml @@ -0,0 +1,134 @@ + +name: '[M] Deploy Ten Gateway Frontend' +run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )' +on: + workflow_dispatch: + inputs: + testnet_type: + description: "Testnet Type" + required: true + default: "dev-testnet" + type: choice + options: + - "dev-testnet" + - "uat-testnet" + - "sepolia-testnet" + instance_type: + description: "Instance" + required: true + default: "primary" + type: choice + options: + - "primary" + - "dexynth" + gateway_url: + description: "Gateway URL" + required: false + tag: + description: 'Tag to build and push (leave empty for latest)' + required: true + default: '' + +jobs: + build-and-release: + runs-on: ubuntu-latest + environment: + name: ${{ github.event.inputs.testnet_type }} + steps: + - name: "Set up environment variables" + id: setup_env + run: | + INSTANCE_SUFFIX="" + INSTANCE_PREFIX="" + + if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then + INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}" + INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" + fi + if [[ "${{ github.event.inputs.GATEWAY_URL }}" == "" ]]; then + GATEWAY_URL="${{ env.GATEWAY_URL }}" + fi + + echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV + echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV + + + DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}" + IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}" + + echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV + echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + + # Set instance-specific variables + declare -a VAR_NAMES=( + "DOCKER_BUILD_TAG_GATEWAY_FE" + "GATEWAY_URL" + "NETWORK_NAME" + "TENSCAN_URL" + ) + + for VAR_NAME in "${VAR_NAMES[@]}"; do + FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}" + VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}') + if [[ -n "$VAR_VALUE" ]]; then + echo "${VAR_NAME}=${VAR_VALUE}" >> $GITHUB_ENV + else + echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2 + fi + done + + - name: "Print GitHub variables" + run: | + echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" + echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" + echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" + echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" + echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" + echo "GATEWAY_URL: $GATEWAY_URL" + echo "NETWORK_NAME: $NETWORK_NAME" + echo "TENSCAN_URL: $TENSCAN_URL" + - name: 'Get version' + id: get_version + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + elif [ -n "${{ github.event.inputs.tag }}" ]; then + echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + else + # Fetch the latest tag from the repository + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT + fi + + - uses: actions/checkout@v4 + + - name: "Extract branch name" + shell: bash + run: | + echo "Branch Name: ${GITHUB_REF_NAME}" + echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + - name: "Set up Docker" + uses: docker/setup-buildx-action@v3.6.1 + + - name: "Login to Azure docker registry" + uses: azure/docker-login@v1 + with: + login-server: testnetobscuronet.azurecr.io + username: testnetobscuronet + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: "Login via Azure CLI" + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: 'Build and Push Docker Image' + run: | + DOCKER_BUILDKIT=1 docker build \ + --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ + --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ + --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ + -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ + -f ./tools/walletextension/frontend/Dockerfile . + docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ No newline at end of file From 090c5d133ae9feb508c3d0fa3830d5e24217091e Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:09:08 +0000 Subject: [PATCH 05/18] fixed GHA to release gw FE image --- .../workflows/build-release-gw-fe-image.yml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-release-gw-fe-image.yml b/.github/workflows/build-release-gw-fe-image.yml index 9d9519ac5d..d20864547d 100644 --- a/.github/workflows/build-release-gw-fe-image.yml +++ b/.github/workflows/build-release-gw-fe-image.yml @@ -88,17 +88,17 @@ jobs: echo "NETWORK_NAME: $NETWORK_NAME" echo "TENSCAN_URL: $TENSCAN_URL" - name: 'Get version' - id: get_version - run: | - if [ "${{ github.event_name }}" = "release" ]; then - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - elif [ -n "${{ github.event.inputs.tag }}" ]; then - echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT - else - # Fetch the latest tag from the repository - LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT - fi + id: get_version + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + elif [ -n "${{ github.event.inputs.tag }}" ]; then + echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + else + # Fetch the latest tag from the repository + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT + fi - uses: actions/checkout@v4 From 3bc9ec0f089a823190d48995e7536529d37461f6 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:15:35 +0000 Subject: [PATCH 06/18] triggering action From 4dc86a535eb3eff3aff9542f7db25aa12f2f29e4 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:22:17 +0000 Subject: [PATCH 07/18] fixed action --- .../workflows/build-release-gw-fe-image.yml | 92 ++++--------------- 1 file changed, 19 insertions(+), 73 deletions(-) diff --git a/.github/workflows/build-release-gw-fe-image.yml b/.github/workflows/build-release-gw-fe-image.yml index d20864547d..f8b827f9be 100644 --- a/.github/workflows/build-release-gw-fe-image.yml +++ b/.github/workflows/build-release-gw-fe-image.yml @@ -1,6 +1,5 @@ - -name: '[M] Deploy Ten Gateway Frontend' -run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )' +name: '[M] Build and Release Ten Gateway Frontend' +run-name: '[M] Build and Release Frontend (${{ github.event.inputs.testnet_type }})' on: workflow_dispatch: inputs: @@ -22,13 +21,13 @@ on: - "primary" - "dexynth" gateway_url: - description: "Gateway URL" + description: "Gateway URL (optional)" required: false tag: - description: 'Tag to build and push (leave empty for latest)' + description: "Tag to build and push (leave empty for latest)" required: true default: '' - + jobs: build-and-release: runs-on: ubuntu-latest @@ -40,18 +39,21 @@ jobs: run: | INSTANCE_SUFFIX="" INSTANCE_PREFIX="" - + if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}" INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" fi - if [[ "${{ github.event.inputs.GATEWAY_URL }}" == "" ]]; then + + if [[ -z "${{ github.event.inputs.gateway_url }}" ]]; then GATEWAY_URL="${{ env.GATEWAY_URL }}" + else + GATEWAY_URL="${{ github.event.inputs.gateway_url }}" fi echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV - + echo "GATEWAY_URL=$GATEWAY_URL" >> $GITHUB_ENV DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}" IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}" @@ -59,76 +61,20 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV - # Set instance-specific variables - declare -a VAR_NAMES=( - "DOCKER_BUILD_TAG_GATEWAY_FE" - "GATEWAY_URL" - "NETWORK_NAME" - "TENSCAN_URL" - ) - - for VAR_NAME in "${VAR_NAMES[@]}"; do - FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}" - VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}') - if [[ -n "$VAR_VALUE" ]]; then - echo "${VAR_NAME}=${VAR_VALUE}" >> $GITHUB_ENV - else - echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2 - fi - done - - - name: "Print GitHub variables" - run: | - echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" - echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" - echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" - echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" - echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" - echo "GATEWAY_URL: $GATEWAY_URL" - echo "NETWORK_NAME: $NETWORK_NAME" - echo "TENSCAN_URL: $TENSCAN_URL" - - name: 'Get version' - id: get_version - run: | - if [ "${{ github.event_name }}" = "release" ]; then - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - elif [ -n "${{ github.event.inputs.tag }}" ]; then - echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT - else - # Fetch the latest tag from the repository - LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT - fi - - uses: actions/checkout@v4 - - name: "Extract branch name" - shell: bash + - name: "Build and Push Docker Image" run: | - echo "Branch Name: ${GITHUB_REF_NAME}" - echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV - - - name: "Set up Docker" - uses: docker/setup-buildx-action@v3.6.1 - - - name: "Login to Azure docker registry" - uses: azure/docker-login@v1 - with: - login-server: testnetobscuronet.azurecr.io - username: testnetobscuronet - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: "Login via Azure CLI" - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} + VERSION="${{ github.event.inputs.tag }}" + if [[ -z "$VERSION" ]]; then + VERSION=$(git describe --tags `git rev-list --tags --max-count=1` || echo "latest") + fi + echo "VERSION=${VERSION}" - - name: 'Build and Push Docker Image' - run: | DOCKER_BUILDKIT=1 docker build \ --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ + -t ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }}:${VERSION} \ No newline at end of file + docker push ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} From 092333a591e6cfbd9dccaa949996915cc84f8bd6 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:26:19 +0000 Subject: [PATCH 08/18] renamed action --- ...{build-release-gw-fe-image.yml => build-release-gw-images.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-release-gw-fe-image.yml => build-release-gw-images.yml} (100%) diff --git a/.github/workflows/build-release-gw-fe-image.yml b/.github/workflows/build-release-gw-images.yml similarity index 100% rename from .github/workflows/build-release-gw-fe-image.yml rename to .github/workflows/build-release-gw-images.yml From 1851d6d1b19f3c791cc127efbc15a903eaef8d06 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 17:48:01 +0000 Subject: [PATCH 09/18] testing with existing gha --- .../manual-deploy-ten-gateway-frontend.yml | 106 +++++------------- 1 file changed, 27 insertions(+), 79 deletions(-) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 59ff2e13f5..b3c01a6d20 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -9,8 +9,8 @@ # If we are deploying to a non primary instance all those variables should be prefixed with the instance name # example: dexynth-GATEWAY_URL -name: '[M] Deploy Ten Gateway Frontend' -run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )' +name: '[M] Build and Release Ten Gateway Frontend' +run-name: '[M] Build and Release Frontend (${{ github.event.inputs.testnet_type }})' on: workflow_dispatch: inputs: @@ -31,17 +31,16 @@ on: options: - "primary" - "dexynth" + gateway_url: + description: "Gateway URL (optional)" + required: false + tag: + description: "Tag to build and push (leave empty for latest)" + required: true + default: '' + jobs: - validate-inputs: - runs-on: ubuntu-latest - steps: - - name: "Check if deployment is allowed" - run: | - if [[ "${{ github.event.inputs.instance_type }}" == "dexynth" && "${{ github.event.inputs.testnet_type }}" != "sepolia-testnet" ]]; then - echo "Error: Dexynth can only be deployed to sepolia-testnet." - exit 1 - fi - build-and-deploy: + build-and-release: runs-on: ubuntu-latest environment: name: ${{ github.event.inputs.testnet_type }} @@ -51,15 +50,21 @@ jobs: run: | INSTANCE_SUFFIX="" INSTANCE_PREFIX="" - + if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}" INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" fi + if [[ -z "${{ github.event.inputs.gateway_url }}" ]]; then + GATEWAY_URL="${{ env.GATEWAY_URL }}" + else + GATEWAY_URL="${{ github.event.inputs.gateway_url }}" + fi + echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV - + echo "GATEWAY_URL=$GATEWAY_URL" >> $GITHUB_ENV DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}" IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}" @@ -67,77 +72,20 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV - # Set instance-specific variables - declare -a VAR_NAMES=( - "DOCKER_BUILD_TAG_GATEWAY_FE" - "GATEWAY_URL" - "NETWORK_NAME" - "TENSCAN_URL" - ) - - for VAR_NAME in "${VAR_NAMES[@]}"; do - FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}" - VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}') - if [[ -n "$VAR_VALUE" ]]; then - echo "${VAR_NAME}=${VAR_VALUE}" >> $GITHUB_ENV - else - echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2 - fi - done - - - name: "Print GitHub variables" - run: | - echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" - echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" - echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" - echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" - echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" - echo "GATEWAY_URL: $GATEWAY_URL" - echo "NETWORK_NAME: $NETWORK_NAME" - echo "TENSCAN_URL: $TENSCAN_URL" - - uses: actions/checkout@v4 - - name: "Extract branch name" - shell: bash + - name: "Build and Push Docker Image" run: | - echo "Branch Name: ${GITHUB_REF_NAME}" - echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV - - - name: "Set up Docker" - uses: docker/setup-buildx-action@v3.6.1 - - - name: "Login to Azure docker registry" - uses: azure/docker-login@v1 - with: - login-server: testnetobscuronet.azurecr.io - username: testnetobscuronet - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: "Login via Azure CLI" - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} + VERSION="${{ github.event.inputs.tag }}" + if [[ -z "$VERSION" ]]; then + VERSION=$(git describe --tags `git rev-list --tags --max-count=1` || echo "latest") + fi + echo "VERSION=${VERSION}" - - name: 'Build and Push Docker Image' - run: | DOCKER_BUILDKIT=1 docker build \ --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} \ + -t ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} - - - name: 'Deploy Gateway FE to Azure Container Instances' - uses: "azure/aci-deploy@v1" - with: - resource-group: ${{ secrets.RESOURCE_GROUP }} - dns-name-label: ${{ env.DNS_NAME_LABEL_GATEWAY_FE }} - image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} - name: ${{ env.IMAGE_NAME_GATEWAY_FE }} - location: "uksouth" - restart-policy: "Never" - ports: "80" - cpu: 2 - memory: 2 \ No newline at end of file + docker push ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} From 8292104a1ea8cb9ac3c68b322587f7862e69d9a3 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 18:11:36 +0000 Subject: [PATCH 10/18] testing with existing gha --- .github/workflows/build-release-gw-images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index f8b827f9be..182c714fd2 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -75,6 +75,6 @@ jobs: --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ + -t testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} + docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} From d16e7c8e4d4f5ab2f642441005ad9201ac6d0e02 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 18:14:42 +0000 Subject: [PATCH 11/18] testing with existing gha --- .../manual-deploy-ten-gateway-frontend.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index b3c01a6d20..182c714fd2 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -1,14 +1,3 @@ -# Deploys TEN Gateway Frontend on Azure for Testnet -# Builds the TEN Gateway image, pushes the image to dockerhub and starts the TEN Gateway on Azure VM -# This action requires the following environment variables to be set: -# - DOCKER_BUILD_TAG_GATEWAY_FE -# - GATEWAY_URL -# - NETWORK_NAME -# - TENSCAN_URL - -# If we are deploying to a non primary instance all those variables should be prefixed with the instance name -# example: dexynth-GATEWAY_URL - name: '[M] Build and Release Ten Gateway Frontend' run-name: '[M] Build and Release Frontend (${{ github.event.inputs.testnet_type }})' on: @@ -86,6 +75,6 @@ jobs: --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ + -t testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push ${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} + docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} From 30296a3d7799e2c4dca759af36ca01814b8c172d Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Wed, 22 Jan 2025 18:22:00 +0000 Subject: [PATCH 12/18] testing with existing gha --- .../manual-deploy-ten-gateway-frontend.yml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 182c714fd2..72964cbb9f 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -61,8 +61,40 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + - name: "Print GitHub variables" + run: | + echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" + echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" + echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" + echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" + echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" + echo "GATEWAY_URL: $GATEWAY_URL" + echo "NETWORK_NAME: $NETWORK_NAME" + echo "TENSCAN_URL: $TENSCAN_URL" + - uses: actions/checkout@v4 + - name: "Extract branch name" + shell: bash + run: | + echo "Branch Name: ${GITHUB_REF_NAME}" + echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + - name: "Set up Docker" + uses: docker/setup-buildx-action@v3.6.1 + + - name: "Login to Azure docker registry" + uses: azure/docker-login@v1 + with: + login-server: testnetobscuronet.azurecr.io + username: testnetobscuronet + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: "Login via Azure CLI" + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + - name: "Build and Push Docker Image" run: | VERSION="${{ github.event.inputs.tag }}" From 55ff8ab73cd1b0ac06abeef403a47c6f16c9cf1b Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Thu, 23 Jan 2025 12:15:16 +0000 Subject: [PATCH 13/18] revert manual build and deploy gw frontend action --- .github/workflows/build-release-gw-images.yml | 34 +++++++- .../manual-deploy-ten-gateway-frontend.yml | 87 +++++++++++++------ 2 files changed, 92 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index 182c714fd2..ee6c4bf062 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -61,8 +61,40 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + - name: "Print GitHub variables" + run: | + echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" + echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" + echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" + echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" + echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" + echo "GATEWAY_URL: $GATEWAY_URL" + echo "NETWORK_NAME: $NETWORK_NAME" + echo "TENSCAN_URL: $TENSCAN_URL" + - uses: actions/checkout@v4 + - name: "Extract branch name" + shell: bash + run: | + echo "Branch Name: ${GITHUB_REF_NAME}" + echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + - name: "Set up Docker" + uses: docker/setup-buildx-action@v3.6.1 + + - name: "Login to Azure docker registry" + uses: azure/docker-login@v1 + with: + login-server: testnetobscuronet.azurecr.io + username: testnetobscuronet + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: "Login via Azure CLI" + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + - name: "Build and Push Docker Image" run: | VERSION="${{ github.event.inputs.tag }}" @@ -77,4 +109,4 @@ jobs: --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ -t testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} + docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ No newline at end of file diff --git a/.github/workflows/manual-deploy-ten-gateway-frontend.yml b/.github/workflows/manual-deploy-ten-gateway-frontend.yml index 72964cbb9f..59ff2e13f5 100644 --- a/.github/workflows/manual-deploy-ten-gateway-frontend.yml +++ b/.github/workflows/manual-deploy-ten-gateway-frontend.yml @@ -1,5 +1,16 @@ -name: '[M] Build and Release Ten Gateway Frontend' -run-name: '[M] Build and Release Frontend (${{ github.event.inputs.testnet_type }})' +# Deploys TEN Gateway Frontend on Azure for Testnet +# Builds the TEN Gateway image, pushes the image to dockerhub and starts the TEN Gateway on Azure VM +# This action requires the following environment variables to be set: +# - DOCKER_BUILD_TAG_GATEWAY_FE +# - GATEWAY_URL +# - NETWORK_NAME +# - TENSCAN_URL + +# If we are deploying to a non primary instance all those variables should be prefixed with the instance name +# example: dexynth-GATEWAY_URL + +name: '[M] Deploy Ten Gateway Frontend' +run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )' on: workflow_dispatch: inputs: @@ -20,16 +31,17 @@ on: options: - "primary" - "dexynth" - gateway_url: - description: "Gateway URL (optional)" - required: false - tag: - description: "Tag to build and push (leave empty for latest)" - required: true - default: '' - jobs: - build-and-release: + validate-inputs: + runs-on: ubuntu-latest + steps: + - name: "Check if deployment is allowed" + run: | + if [[ "${{ github.event.inputs.instance_type }}" == "dexynth" && "${{ github.event.inputs.testnet_type }}" != "sepolia-testnet" ]]; then + echo "Error: Dexynth can only be deployed to sepolia-testnet." + exit 1 + fi + build-and-deploy: runs-on: ubuntu-latest environment: name: ${{ github.event.inputs.testnet_type }} @@ -39,21 +51,15 @@ jobs: run: | INSTANCE_SUFFIX="" INSTANCE_PREFIX="" - + if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}" INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-" fi - if [[ -z "${{ github.event.inputs.gateway_url }}" ]]; then - GATEWAY_URL="${{ env.GATEWAY_URL }}" - else - GATEWAY_URL="${{ github.event.inputs.gateway_url }}" - fi - echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV - echo "GATEWAY_URL=$GATEWAY_URL" >> $GITHUB_ENV + DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}" IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}" @@ -61,6 +67,24 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + # Set instance-specific variables + declare -a VAR_NAMES=( + "DOCKER_BUILD_TAG_GATEWAY_FE" + "GATEWAY_URL" + "NETWORK_NAME" + "TENSCAN_URL" + ) + + for VAR_NAME in "${VAR_NAMES[@]}"; do + FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}" + VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}') + if [[ -n "$VAR_VALUE" ]]; then + echo "${VAR_NAME}=${VAR_VALUE}" >> $GITHUB_ENV + else + echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2 + fi + done + - name: "Print GitHub variables" run: | echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" @@ -95,18 +119,25 @@ jobs: with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: "Build and Push Docker Image" + - name: 'Build and Push Docker Image' run: | - VERSION="${{ github.event.inputs.tag }}" - if [[ -z "$VERSION" ]]; then - VERSION=$(git describe --tags `git rev-list --tags --max-count=1` || echo "latest") - fi - echo "VERSION=${VERSION}" - DOCKER_BUILDKIT=1 docker build \ --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ + -t ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} + docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} + + - name: 'Deploy Gateway FE to Azure Container Instances' + uses: "azure/aci-deploy@v1" + with: + resource-group: ${{ secrets.RESOURCE_GROUP }} + dns-name-label: ${{ env.DNS_NAME_LABEL_GATEWAY_FE }} + image: ${{ env.DOCKER_BUILD_TAG_GATEWAY_FE }} + name: ${{ env.IMAGE_NAME_GATEWAY_FE }} + location: "uksouth" + restart-policy: "Never" + ports: "80" + cpu: 2 + memory: 2 \ No newline at end of file From f5c9df27c1c6da4738aa6174bfc7bffda5569f4d Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Thu, 23 Jan 2025 12:27:38 +0000 Subject: [PATCH 14/18] fixed image tag --- .github/workflows/build-release-gw-images.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index ee6c4bf062..2fb641cd10 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -61,6 +61,10 @@ jobs: echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + SANITIZED_TESTNET_TYPE=$(echo "${{ github.event.inputs.testnet_type }}" | tr '-' '_') + IMAGE_NAME_GATEWAY_FE="obscuro_gateway_${SANITIZED_TESTNET_TYPE}_fe" + echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + - name: "Print GitHub variables" run: | echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" @@ -107,6 +111,6 @@ jobs: --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ - -t testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ + -t testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway_dev_testnet_fe:${VERSION} \ No newline at end of file + docker push testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ No newline at end of file From d36a37c4548a8511d844ca5ab22fb6aad3060f5e Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Thu, 23 Jan 2025 12:57:17 +0000 Subject: [PATCH 15/18] added missing env specific vars --- .github/workflows/build-release-gw-images.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index 2fb641cd10..b59546d6de 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -65,6 +65,23 @@ jobs: IMAGE_NAME_GATEWAY_FE="obscuro_gateway_${SANITIZED_TESTNET_TYPE}_fe" echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV + # Set instance-specific variables + declare -a VAR_NAMES=( + "GATEWAY_URL" + "NETWORK_NAME" + "TENSCAN_URL" + ) + + for VAR_NAME in "${VAR_NAMES[@]}"; do + FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}" + VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}') + if [[ -n "$VAR_VALUE" ]]; then + echo "${VAR_NAME}=${VAR_VALUE}" >> $GITHUB_ENV + else + echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2 + fi + done + - name: "Print GitHub variables" run: | echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}" From 7e2976108355c146d921caa0b2a8c0f0233fecd4 Mon Sep 17 00:00:00 2001 From: "krishnath.poologanathan" Date: Thu, 23 Jan 2025 12:59:22 +0000 Subject: [PATCH 16/18] added missing env specific vars --- .github/workflows/build-release-gw-images.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index b59546d6de..62b67c3b53 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -88,7 +88,6 @@ jobs: echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}" echo "DNS_NAME_LABEL_GATEWAY_FE: $DNS_NAME_LABEL_GATEWAY_FE" echo "IMAGE_NAME_GATEWAY_FE: $IMAGE_NAME_GATEWAY_FE" - echo "DOCKER_BUILD_TAG_GATEWAY_FE: $DOCKER_BUILD_TAG_GATEWAY_FE" echo "GATEWAY_URL: $GATEWAY_URL" echo "NETWORK_NAME: $NETWORK_NAME" echo "TENSCAN_URL: $TENSCAN_URL" From d810ede01e74a9e2758faae5da2de446c2d53571 Mon Sep 17 00:00:00 2001 From: krishnath poologanathan Date: Thu, 23 Jan 2025 13:07:48 +0000 Subject: [PATCH 17/18] Update build-release-gw-images.yml --- .github/workflows/build-release-gw-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index 62b67c3b53..0472805f20 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -129,4 +129,4 @@ jobs: --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ -t testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ -f ./tools/walletextension/frontend/Dockerfile . - docker push testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \ No newline at end of file + docker push testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} From ee23fbc8e9c22eaedc96ea9ae5f4a81c00e2a471 Mon Sep 17 00:00:00 2001 From: krishnath poologanathan Date: Thu, 23 Jan 2025 13:18:11 +0000 Subject: [PATCH 18/18] Update build-release-gw-images.yml --- .github/workflows/build-release-gw-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release-gw-images.yml b/.github/workflows/build-release-gw-images.yml index 7de6c4d9ce..542a8299b0 100644 --- a/.github/workflows/build-release-gw-images.yml +++ b/.github/workflows/build-release-gw-images.yml @@ -124,7 +124,7 @@ jobs: echo "VERSION=${VERSION}" DOCKER_BUILDKIT=1 docker build \ - --build-arg NEXT_PUBLIC_NETWORK_NAME=${{ env.NETWORK_NAME }} \ + --build-arg NEXT_PUBLIC_NETWORK_NAME="${{ env.NETWORK_NAME }}" \ --build-arg NEXT_PUBLIC_TENSCAN_URL=${{ env.TENSCAN_URL }} \ --build-arg NEXT_PUBLIC_GATEWAY_URL=${{ env.GATEWAY_URL }} \ -t testnetobscuronet.azurecr.io/obscuronet/${{ env.IMAGE_NAME_GATEWAY_FE }}:${VERSION} \