diff --git a/.github/workflows/cicd.yaml b/.github/workflows/build-test-deploy.yaml similarity index 59% rename from .github/workflows/cicd.yaml rename to .github/workflows/build-test-deploy.yaml index 490fa88a..0ed3a2e2 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -1,20 +1,25 @@ -name: Tests, build and deploy +name: Build, test and deploy on: push: branches: - master - - feature/** tags: - v*.*.* pull_request: + types: [opened, reopened, synchronize, labeled] workflow_dispatch: +# 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: - uses: dhis2-sre/gha-workflows/.github/workflows/instance-manager.yaml@master + uses: dhis2-sre/gha-workflows/.github/workflows/im-build-test-deploy.yaml@master 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..2ffc43e6 --- /dev/null +++ b/.github/workflows/delete-env.yaml @@ -0,0 +1,18 @@ +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: + uses: dhis2-sre/gha-workflows/.github/workflows/im-delete-env.yaml@master + 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/helm/data/secrets/feature b/helm/data/secrets/feature new file mode 120000 index 00000000..90012116 --- /dev/null +++ b/helm/data/secrets/feature @@ -0,0 +1 @@ +dev \ No newline at end of file diff --git a/helm/data/values/feature b/helm/data/values/feature new file mode 120000 index 00000000..90012116 --- /dev/null +++ b/helm/data/values/feature @@ -0,0 +1 @@ +dev \ No newline at end of file diff --git a/skaffold.yaml b/skaffold.yaml index 59ab478d..cc0db4bd 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -1,4 +1,4 @@ -apiVersion: skaffold/v2beta25 +apiVersion: skaffold/v4beta6 kind: Config build: artifacts: @@ -13,7 +13,7 @@ deploy: helm: releases: - name: im-web-client-{{ .ENVIRONMENT }} - namespace: instance-manager-{{ .ENVIRONMENT }} + namespace: instance-manager-{{ .CLASSIFICATION }} createNamespace: true chartPath: helm/chart setValueTemplates: @@ -23,3 +23,8 @@ deploy: certIssuer: cert-issuer-prod valuesFiles: - helm/data/values/{{ .CLASSIFICATION }}/values.yaml + +# TODO should we use empty profiles to conform to the instance-manager reusable workflow or have a conditional in the workflow Deploy step (`if repo is im-manager ...`)? +profiles: + - name: dev + - name: prod