From 6bf2455c548a4675cdabf5192f5972cd349542ec Mon Sep 17 00:00:00 2001 From: radnov Date: Thu, 13 Jul 2023 09:57:05 +0300 Subject: [PATCH] refactor: update build-test-deploy workflow and add delete env workflow --- .../{cicd.yaml => build-test-deploy.yaml} | 6 +++--- .github/workflows/delete-env.yaml | 19 +++++++++++++++++++ skaffold.yaml | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) rename .github/workflows/{cicd.yaml => build-test-deploy.yaml} (73%) create mode 100644 .github/workflows/delete-env.yaml diff --git a/.github/workflows/cicd.yaml b/.github/workflows/build-test-deploy.yaml similarity index 73% rename from .github/workflows/cicd.yaml rename to .github/workflows/build-test-deploy.yaml index f7fdda79..75fdcea3 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -1,4 +1,4 @@ -name: Tests, build and deploy +name: Build, test and deploy on: push: @@ -8,6 +8,7 @@ on: - v*.*.* pull_request: + types: [opened, reopened, synchronize, labeled] workflow_dispatch: @@ -19,8 +20,7 @@ concurrency: jobs: call-workflow: # TODO update the branch reference before merging the PR - uses: dhis2-sre/gha-workflows/.github/workflows/instance-manager.yaml@DEVOPS-262 - if: ${{ (github.event_name == 'pull_request' && startsWith(github.head_ref, 'feature/')) || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} + uses: dhis2-sre/gha-workflows/.github/workflows/im-build-test-deploy.yaml@DEVOPS-262 with: PROCESS_NAME: nginx POD_NAME: im-web-client diff --git a/.github/workflows/delete-env.yaml b/.github/workflows/delete-env.yaml new file mode 100644 index 00000000..ee39477d --- /dev/null +++ b/.github/workflows/delete-env.yaml @@ -0,0 +1,19 @@ +name: Delete deployed environment + +on: + pull_request: + types: [closed] + +# Cancel previous runs of the same workflow and PR number or branch/tag +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + call-workflow: + # TODO update the branch reference before merging the PR + uses: dhis2-sre/gha-workflows/.github/workflows/im-delete-env.yaml@DEVOPS-262 + secrets: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/skaffold.yaml b/skaffold.yaml index 7fa41f53..cc0db4bd 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -1,4 +1,4 @@ -apiVersion: skaffold/v2beta25 +apiVersion: skaffold/v4beta6 kind: Config build: artifacts: