From ab28441571d3bfc594fd6936bae48de898f1b353 Mon Sep 17 00:00:00 2001 From: Colin Dembovsky Date: Fri, 23 Apr 2021 09:20:13 -0500 Subject: [PATCH] Updated Deployment With GitHub Actions (markdown) --- Deployment-With-GitHub-Actions.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Deployment-With-GitHub-Actions.md b/Deployment-With-GitHub-Actions.md index 5e890bf..c55faab 100644 --- a/Deployment-With-GitHub-Actions.md +++ b/Deployment-With-GitHub-Actions.md @@ -106,7 +106,8 @@ env: jobs: deploy-to-k8s: - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false runs-on: ubuntu-latest steps: @@ -147,7 +148,7 @@ Note the following: 1. `workflow_run` triggers this workflow when runs of the `catalog-api` workflow run on `dev` and are `completed`. - Some variables are defined inline under the `env` section. - There is a single job called `deploy-to-k8s`. -- The job only executes if the trigger was manual or via the REST API or if it was a workflow run trigger, if the workflow run completed with a `success` status. +- The job is set to never run via the `if: false` condition. This line should be commented out and the other `if` condition should be uncommented (remove the `#`) so that it only executes if the trigger was manual or via the REST API or if it was a workflow run trigger, if the workflow run completed with a `success` status. - The job checks out the repo. - The job then logs into Azure using secret `AZURE_CREDENTIALS`. - The job then sets the AKS context. @@ -185,6 +186,20 @@ If you select the **Actions** tab on your repository, you may already have some Ensure that you see `catalog-api` and `Deploy catalog-api` in the list of workflows. +### Enable deploy jobs + +The deploy jobs will fail if the infrastructure is not created. To prevent this, the `if` condition in the deploy jobs is hard-coded to `if: false`. To enable the jobs, simply comment out this `if` condition and uncomment the other `if` condition. The first couple lines of the job code should look as follows when you are done: + +```yml +jobs: + deploy-to-k8s: + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + #if: false + runs-on: ubuntu-latest +``` + +### Testing the workflows + You can test that the workflow is working correctly by selecting the `catalog-api` workflow. Next, select **Run workflow** to manually trigger the workflow. Select the `dev` branch. ![Triggering the catalog-api workflow manually](./images/Deployment-With-GitHub-Actions/trigger-catalog-api.jpg)