From 195f3b841fd4635c800e8eed4ed707f00ad21113 Mon Sep 17 00:00:00 2001 From: "amy.muhimpundu" Date: Tue, 3 Dec 2024 16:30:39 +0200 Subject: [PATCH] chore(SER-3309): Refactor GA deployment jobs to avoid duplicationg env variables --- .github/workflows/build.yml | 79 +++++------------------------------- .github/workflows/deploy.yml | 54 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7ae5a8c2..085e34720 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,81 +125,22 @@ jobs: ## Deploy to the various clusters Integration-k8s: if: github.event.ref == 'refs/heads/develop' - runs-on: ubuntu-latest needs: [build, sonarcloud] - environment: - name: Integration - steps: - - uses: actions/checkout@v4.1.0 - - - uses: one-acre-fund/oaf-actions/helm_setup@main - with: - ARTIFACT_NAME: "fineract-frontend-v2" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - RUN_ID: "${{ github.run_id }}" - CI_REPOSITORY: "${{ github.repository }}" - K8S_URL: "${{ secrets.K8S_TEST_URL }}" - K8S_SECRET: "${{ secrets.K8S_TEST_DEFAULT }}" + uses: ./.github/workflows/deploy.yml + with: + environment: "Integration" + k8s_url: "${{ secrets.K8S_TEST_URL }}" + k8s_secret: "${{ secrets.K8S_TEST_DEFAULT }}" - - uses: "./.github/actions/helm_fineract_frontend" - with: - NAMESPACE: "${{ vars.NAMESPACE }}" - ACR_PULL_PASSWORD: "${{ secrets.ACR_PULL_PASSWORD }}" - ACR_PULL_USERNAME: "${{ vars.ACR_PULL_USERNAME }}" - REPLICAS: "${{ vars.REPLICAS }}" - RELEASE_NAME: "${{ vars.RELEASE_NAME }}" - FINERACT_PROXY_URL: "${{ vars.FINERACT_PROXY_URL }}" - FINERACT_PROXY_HTTPS_PORT: "${{ vars.FINERACT_PROXY_HTTPS_PORT }}" - FINERACT_PROXY_HTTP_PORT: "${{ vars.FINERACT_PROXY_HTTP_PORT }}" - FINERACT_KEYCLOAK_REALM: "${{ vars.FINERACT_KEYCLOAK_REALM }}" - FINERACT_KEYCLOAK_CLIENT_ID: "${{ vars.FINERACT_KEYCLOAK_CLIENT_ID }}" - FINERACT_KEYCLOAK_TOKEN_URL: "${{ vars.FINERACT_KEYCLOAK_TOKEN_URL }}" - FINERACT_KEYCLOAK_AUTH_SERVER_URL: "${{ vars.FINERACT_KEYCLOAK_AUTH_SERVER_URL }}" - FINERACT_KEYCLOAK_API_URL: "${{ vars.FINERACT_KEYCLOAK_API_URL }}" - FINERACT_HOST_HOME_URL: "${{ vars.FINERACT_HOST_HOME_URL }}" - FINERACT_BASE_URL: "${{ vars.FINERACT_BASE_URL }}" - FINERACT_AUTH_URL: "${{ vars.FINERACT_AUTH_URL }}" - FINERACT_API_URL: "${{ vars.FINERACT_API_URL }}" - MATOMO_SITE_ID: "${{ vars.MATOMO_SITE_ID }}" - MATOMO_SITE_URL: "${{ vars.MATOMO_SITE_URL }}" QA-k8s: - runs-on: ubuntu-latest needs: Integration-k8s if: github.event.ref == 'refs/heads/develop' - environment: - name: QA - steps: - - uses: actions/checkout@v4.1.0 + uses: ./.github/workflows/deploy.yml + with: + environment: "QA" + k8s_url: "${{ secrets.K8S_QA_URL }}" + k8s_secret: "${{ secrets.K8S_QA_DEFAULT }}" - - uses: one-acre-fund/oaf-actions/helm_setup@main - with: - ARTIFACT_NAME: "fineract-frontend-v2" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - RUN_ID: "${{ github.run_id }}" - CI_REPOSITORY: "${{ github.repository }}" - K8S_URL: "${{ secrets.K8S_QA_URL }}" - K8S_SECRET: "${{ secrets.K8S_QA_DEFAULT }}" - - uses: "./.github/actions/helm_fineract_frontend" - with: - NAMESPACE: "${{ vars.NAMESPACE }}" - ACR_PULL_PASSWORD: "${{ secrets.ACR_PULL_PASSWORD }}" - ACR_PULL_USERNAME: "${{ vars.ACR_PULL_USERNAME }}" - REPLICAS: "${{ vars.REPLICAS }}" - RELEASE_NAME: "${{ vars.RELEASE_NAME }}" - FINERACT_PROXY_URL: "${{ vars.FINERACT_PROXY_URL }}" - FINERACT_PROXY_HTTPS_PORT: "${{ vars.FINERACT_PROXY_HTTPS_PORT }}" - FINERACT_PROXY_HTTP_PORT: "${{ vars.FINERACT_PROXY_HTTP_PORT }}" - FINERACT_KEYCLOAK_REALM: "${{ vars.FINERACT_KEYCLOAK_REALM }}" - FINERACT_KEYCLOAK_CLIENT_ID: "${{ vars.FINERACT_KEYCLOAK_CLIENT_ID }}" - FINERACT_KEYCLOAK_TOKEN_URL: "${{ vars.FINERACT_KEYCLOAK_TOKEN_URL }}" - FINERACT_KEYCLOAK_AUTH_SERVER_URL: "${{ vars.FINERACT_KEYCLOAK_AUTH_SERVER_URL }}" - FINERACT_KEYCLOAK_API_URL: "${{ vars.FINERACT_KEYCLOAK_API_URL }}" - FINERACT_HOST_HOME_URL: "${{ vars.FINERACT_HOST_HOME_URL }}" - FINERACT_BASE_URL: "${{ vars.FINERACT_BASE_URL }}" - FINERACT_AUTH_URL: "${{ vars.FINERACT_AUTH_URL }}" - FINERACT_API_URL: "${{ vars.FINERACT_API_URL }}" - MATOMO_SITE_ID: "${{ vars.MATOMO_SITE_ID }}" - MATOMO_SITE_URL: "${{ vars.MATOMO_SITE_URL }}" UAT-k8s: runs-on: ubuntu-latest if: github.event.ref == 'refs/heads/main' || contains(github.event.ref, 'refs/heads/hotfix/') || contains(github.event.ref, 'refs/heads/release/') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..719607eb1 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,54 @@ +name: Deploy Workflow + +on: + workflow_call: + inputs: + environment: + required: true + type: string + k8s_url: + required: true + type: string + k8s_secret: + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: ${{ inputs.environment }} + steps: + - uses: actions/checkout@v4 + + - uses: one-acre-fund/oaf-actions/helm_setup@main + with: + ARTIFACT_NAME: "fineract-frontend-v2" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + RUN_ID: "${{ github.run_id }}" + CI_REPOSITORY: "${{ github.repository }}" + K8S_URL: "${{ inputs.k8s_url }}" + K8S_SECRET: "${{ inputs.k8s_secret }}" + + - uses: "./.github/actions/helm_fineract_frontend" + with: + NAMESPACE: "${{ vars.NAMESPACE }}" + ACR_PULL_PASSWORD: "${{ secrets.ACR_PULL_PASSWORD }}" + ACR_PULL_USERNAME: "${{ vars.ACR_PULL_USERNAME }}" + REPLICAS: "${{ vars.REPLICAS }}" + RELEASE_NAME: "${{ vars.RELEASE_NAME }}" + FINERACT_PROXY_URL: "${{ vars.FINERACT_PROXY_URL }}" + FINERACT_PROXY_HTTPS_PORT: "${{ vars.FINERACT_PROXY_HTTPS_PORT }}" + FINERACT_PROXY_HTTP_PORT: "${{ vars.FINERACT_PROXY_HTTP_PORT }}" + FINERACT_KEYCLOAK_REALM: "${{ vars.FINERACT_KEYCLOAK_REALM }}" + FINERACT_KEYCLOAK_CLIENT_ID: "${{ vars.FINERACT_KEYCLOAK_CLIENT_ID }}" + FINERACT_KEYCLOAK_TOKEN_URL: "${{ vars.FINERACT_KEYCLOAK_TOKEN_URL }}" + FINERACT_KEYCLOAK_AUTH_SERVER_URL: "${{ vars.FINERACT_KEYCLOAK_AUTH_SERVER_URL }}" + FINERACT_KEYCLOAK_API_URL: "${{ vars.FINERACT_KEYCLOAK_API_URL }}" + FINERACT_HOST_HOME_URL: "${{ vars.FINERACT_HOST_HOME_URL }}" + FINERACT_BASE_URL: "${{ vars.FINERACT_BASE_URL }}" + FINERACT_AUTH_URL: "${{ vars.FINERACT_AUTH_URL }}" + FINERACT_API_URL: "${{ vars.FINERACT_API_URL }}" + MATOMO_SITE_ID: "${{ vars.MATOMO_SITE_ID }}" + MATOMO_SITE_URL: "${{ vars.MATOMO_SITE_URL }}" + SENTRY_DSN: "${{ secrets.SENTRY_DSN }}"