Skip to content

Commit

Permalink
Merge pull request #240 from DFE-Digital/devops/status_cake/frequency…
Browse files Browse the repository at this point in the history
…_update

Changed status Cake check frequency to every minute
  • Loading branch information
sfawcett123 authored Sep 4, 2020
2 parents ac60d2a + b2ec91c commit e28213e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/statuscake.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 0 additions & 2 deletions terraform/statuscake/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
2 changes: 1 addition & 1 deletion terraform/statuscake/test.env.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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\"}"
Expand Down
2 changes: 0 additions & 2 deletions terraform/statuscake/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ variable "sc_api_key" {}
variable "alerts" {
type = map
}
variable HTTPAUTH_USERNAME {}
variable HTTPAUTH_PASSWORD {}

0 comments on commit e28213e

Please sign in to comment.