diff --git a/.github/workflows/statuscake.yml b/.github/workflows/statuscake.yml new file mode 100644 index 000000000..a69b58bd8 --- /dev/null +++ b/.github/workflows/statuscake.yml @@ -0,0 +1,61 @@ +name: Deploy Status Cake (Beta Test) +on: + workflow_dispatch: + +jobs: + deploy: + name: Status Cake Configuration + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.12.29 + + - name: Get Short SHA + id: sha + run: echo ::set-output name=short::$(git rev-parse --short $GITHUB_SHA) + + - name: Smoke Test + run: | + tests/confidence/healthcheck.sh "get-into-teaching-api-test" "${{steps.sha.outputs.short}}" + + - name: Terraform Init + run: | + cd terraform/statuscake && pwd + terraform init -backend-config=test.bk.vars + env: + ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" + TF_VAR_sc_username: "DfEStatusCake" + TF_VAR_sc_api_key: "${{ secrets.STATUS_CAKE_API }}" + + - name: Terraform Plan + run: | + cd terraform/statuscake && pwd + terraform plan -var-file=test.env.tfvars -out plan + env: + ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" + TF_VAR_sc_username: "DfEStatusCake" + TF_VAR_sc_api_key: "${{ secrets.STATUS_CAKE_API }}" + + - name: Terraform Apply + run: | + cd terraform/statuscake && pwd + terraform apply -auto-approve plan + env: + ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" + TF_VAR_sc_username: "DfEStatusCake" + TF_VAR_sc_api_key: "${{ secrets.STATUS_CAKE_API }}" + + - name: Slack Notification + if: failure() + uses: rtCamp/action-slack-notify@master + env: + SLACK_CHANNEL: getintoteaching_tech + SLACK_COLOR: '#3278BD' + SLACK_ICON: https://github.com/rtCamp.png?size=48 + SLACK_MESSAGE: ':disappointed_relieved: Get-Into-Teaching-API Pipeline Failed Configuring Status Cake ${{github.job}} :disappointed_relieved:' + SLACK_TITLE: 'Failure: ${{ github.workflow }}' + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/terraform/statuscake/resources.tf b/terraform/statuscake/resources.tf index 1be34c012..5b9f969dd 100644 --- a/terraform/statuscake/resources.tf +++ b/terraform/statuscake/resources.tf @@ -9,7 +9,5 @@ resource statuscake_test alert { trigger_rate = each.value.trigger_rate custom_header = each.value.custom_header status_codes = each.value.status_codes - basic_user = var.HTTPAUTH_USERNAME - basic_pass = var.HTTPAUTH_PASSWORD test_tags = [ "GIT" , "BETA" ] } diff --git a/terraform/statuscake/test.env.tfvars b/terraform/statuscake/test.env.tfvars index 9f90aece1..5414fc326 100644 --- a/terraform/statuscake/test.env.tfvars +++ b/terraform/statuscake/test.env.tfvars @@ -3,7 +3,7 @@ ftt = { website_name = "Get Teacher Training API (Beta test)" website_url = "https://get-into-teaching-api-test.london.cloudapps.digital/api/operations/health_check" test_type = "HTTP" - check_rate = 300 + check_rate = 60 contact_group = [185037] trigger_rate = 0 custom_header = "{\"Content-Type\": \"application/x-www-form-urlencoded\"}" diff --git a/terraform/statuscake/variables.tf b/terraform/statuscake/variables.tf index 921676dc5..a8ab4c8ef 100644 --- a/terraform/statuscake/variables.tf +++ b/terraform/statuscake/variables.tf @@ -3,5 +3,3 @@ variable "sc_api_key" {} variable "alerts" { type = map } -variable HTTPAUTH_USERNAME {} -variable HTTPAUTH_PASSWORD {}