From 7425d146af2578f8375724f7e0e645e3d31e33d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Tue, 19 Jul 2022 11:09:10 +0200 Subject: [PATCH] feat: add accountapp login synthetic monitor Ref: https://github.com/jenkins-infra/helpdesk/issues/1323 --- Jenkinsfile_k8s | 2 ++ synthetics_accountapp-login.tf | 28 ++++++++++++++++++++++++++++ variables.tf | 1 + 3 files changed, 31 insertions(+) create mode 100644 synthetics_accountapp-login.tf diff --git a/Jenkinsfile_k8s b/Jenkinsfile_k8s index 374b661..e6d0f12 100644 --- a/Jenkinsfile_k8s +++ b/Jenkinsfile_k8s @@ -8,11 +8,13 @@ parallel( // TODO: create an empty account for staging string(variable: 'TF_VAR_datadog_api_key', credentialsId: 'datadog-api-key'), string(variable: 'TF_VAR_datadog_app_key', credentialsId: 'datadog-app-key'), + string(variable: 'TF_VAR_datadog_jenkinsuser_password', credentialsId: 'datadog-jenkinsuser-password'), file(variable: 'BACKEND_CONFIG_FILE', credentialsId: 'production-terraform-datadog-backend-config'), ], productionCredentials: [ string(variable: 'TF_VAR_datadog_api_key', credentialsId: 'datadog-api-key'), string(variable: 'TF_VAR_datadog_app_key', credentialsId: 'datadog-app-key'), + string(variable: 'TF_VAR_datadog_jenkinsuser_password', credentialsId: 'datadog-jenkinsuser-password'), file(variable: 'BACKEND_CONFIG_FILE', credentialsId: 'production-terraform-datadog-backend-config'), ], ) diff --git a/synthetics_accountapp-login.tf b/synthetics_accountapp-login.tf new file mode 100644 index 0000000..3e4d44a --- /dev/null +++ b/synthetics_accountapp-login.tf @@ -0,0 +1,28 @@ +resource "datadog_synthetics_test" "accountapp-login" { + type = "api" + request_definition { + method = "POST" + url = "https://accounts.jenkins.io/doLogin" + body = "userid=datadog_monitoring&password=${datadog_jenkinsuser_password}" + } + request_headers { + Content-Type = "application/x-www-form-urlencoded" + } + assertion { + type = "statusCode" + operator = "is" + target = "302" + } + locations = ["aws:eu-central-1"] + options_list { + tick_every = 900 + } + name = "login account.jenkins.io" + message = "Notify @pagerduty" + tags = [ + "jenkins.io", + "production" + ] + + status = "live" +} diff --git a/variables.tf b/variables.tf index 60af7c7..46b2c10 100644 --- a/variables.tf +++ b/variables.tf @@ -1,2 +1,3 @@ variable "datadog_api_key" {} variable "datadog_app_key" {} +variable "datadog_jenkinsuser_password" {}