From f218bff2702f9a87777d6dcbecea24fbd14f2985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Vieira?= Date: Thu, 4 Sep 2025 10:37:50 +0100 Subject: [PATCH] Undo changes to use self-hosted runners again in shared workflows --- .github/workflows/shared-build-deploy-container.yml | 7 ++++--- .../workflows/shared-deploy-container-kubernetes.yml | 11 +++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/shared-build-deploy-container.yml b/.github/workflows/shared-build-deploy-container.yml index b7b4fe62..455e609f 100644 --- a/.github/workflows/shared-build-deploy-container.yml +++ b/.github/workflows/shared-build-deploy-container.yml @@ -54,6 +54,7 @@ jobs: runs-on: ubuntu-latest outputs: environment: ${{ steps.load-environment.outputs.environment }} + runnerName: ${{ steps.load-environment.outputs.runnerName }} tagPrefix: ${{ steps.load-environment.outputs.tagPrefix }} steps: - name: Checkout calling repo @@ -66,7 +67,7 @@ jobs: path: ./github-actions-shared-build-deploy-container ref: ${{ inputs.actionsRepoRef }} - - name: Load environment + - name: Load environment and runner id: load-environment uses: ./github-actions-shared-build-deploy-container/load-environment @@ -97,7 +98,7 @@ jobs: build-push-container-image: name: "Build and push container image" needs: [ prepare-and-validate ] - runs-on: ubuntu-latest + runs-on: ${{ needs.prepare-and-validate.outputs.runnerName }} steps: - name: Checkout calling repo uses: actions/checkout@v5 @@ -134,7 +135,7 @@ jobs: deploy-kubernetes: name: "Deploy image to Kubernetes" needs: [ prepare-and-validate, build-push-container-image ] - runs-on: ubuntu-latest + runs-on: ${{ needs.prepare-and-validate.outputs.runnerName }} if: | always() && (needs.build-push-container-image.result == 'success' || (needs.build-push-container-image.result == 'skipped' diff --git a/.github/workflows/shared-deploy-container-kubernetes.yml b/.github/workflows/shared-deploy-container-kubernetes.yml index 0b3e022c..ecf1be91 100644 --- a/.github/workflows/shared-deploy-container-kubernetes.yml +++ b/.github/workflows/shared-deploy-container-kubernetes.yml @@ -40,6 +40,7 @@ jobs: runs-on: ubuntu-latest outputs: environment: ${{ steps.load-environment.outputs.environment }} + runnerName: ${{ steps.load-environment.outputs.runnerName }} steps: - name: Checkout calling repo uses: actions/checkout@v5 @@ -51,20 +52,26 @@ jobs: path: ./github-actions-shared-deploy-image ref: ${{ inputs.actionsRepoRef }} - - name: "Detect Environment" + - name: "Detect Environment and Runner" shell: bash id: load-environment run: | if [[ "${{ inputs.environment }}" == "prod" ]]; then DETECTED_ENVIRONMENT="production" + RUNNER_NAME="prod-trakx-runner" elif [[ "${{ inputs.environment }}" == "stage" ]]; then DETECTED_ENVIRONMENT="staging" + RUNNER_NAME="stage-trakx-runner" else DETECTED_ENVIRONMENT="development" + RUNNER_NAME="dev-trakx-runner" fi echo "Detected Environment is: $DETECTED_ENVIRONMENT" + echo "Detected Runner is: $RUNNER_NAME" + echo "environment=$DETECTED_ENVIRONMENT" >> $GITHUB_OUTPUT + echo "runnerName=$RUNNER_NAME" >> $GITHUB_OUTPUT - name: Outputs if this is a workflow_dispatch for production (manual deploy) shell: bash @@ -93,7 +100,7 @@ jobs: deploy-kubernetes: name: "Deploy image to Kubernetes" needs: [ prepare-and-validate ] - runs-on: ubuntu-latest + runs-on: ${{ needs.prepare-and-validate.outputs.runnerName }} steps: - name: Checkout calling repo uses: actions/checkout@v5