diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7cdc0d8bcf..2c3a76e517 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -525,8 +525,7 @@ jobs: self-host-build: name: Trigger self-host build runs-on: ubuntu-22.04 - needs: - - build-docker + needs: build-docker steps: - name: Login to Azure - CI Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 @@ -555,6 +554,40 @@ jobs: } }) + trigger-k8s-deploy: + name: Trigger k8s deploy + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-22.04 + needs: build-docker + steps: + - name: Login to Azure - CI Subscription + uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve github PAT secrets + id: retrieve-secret-pat + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "github-pat-bitwarden-devops-bot-repo-scope" + + - name: Trigger k8s deploy + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + with: + github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'bitwarden', + repo: 'devops', + workflow_id: 'deploy-k8s.yml', + ref: 'main', + inputs: { + environment: 'US-DEV Cloud', + tag: 'main' + } + }) + check-failures: name: Check for failures if: always() @@ -568,6 +601,7 @@ jobs: - upload - build-mssqlmigratorutility - self-host-build + - trigger-k8s-deploy steps: - name: Check if any job failed if: | @@ -583,6 +617,7 @@ jobs: UPLOAD_STATUS: ${{ needs.upload.result }} BUILD_MSSQLMIGRATORUTILITY_STATUS: ${{ needs.build-mssqlmigratorutility.result }} TRIGGER_SELF_HOST_BUILD_STATUS: ${{ needs.self-host-build.result }} + TRIGGER_K8S_DEPLOY_STATUS: ${{ needs.trigger-k8s-deploy.result }} run: | if [ "$CLOC_STATUS" = "failure" ]; then exit 1 @@ -600,6 +635,8 @@ jobs: exit 1 elif [ "$TRIGGER_SELF_HOST_BUILD_STATUS" = "failure" ]; then exit 1 + elif [ "$TRIGGER_K8S_DEPLOY_STATUS" = "failure" ]; then + exit 1 fi - name: Login to Azure - CI subscription