Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mirrors,get) monitor http to https enforced redirection and use the same pattern for get and mirrors #88

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions synthetics_get.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,35 @@ resource "datadog_synthetics_test" "get_jenkins_io" {
"production"
]

device_ids = [
"laptop_large",
"tablet",
"mobile_small"
status = "live"
}

resource "datadog_synthetics_test" "get_jenkins_io_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://get.jenkins.io"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://get.jenkins.io"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "get.jenkins.io-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins.io",
"production"
]

status = "live"
Expand Down
66 changes: 64 additions & 2 deletions synthetics_mirrors.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "datadog_synthetics_test" "mirrors_jenkins_io" {
type = "api"
request_definition {
method = "GET"
url = "https://mirrors.jenkins.io"
url = "https://mirrors.jenkins.io/debian/jenkins_2.251_all.deb?mirrorlist"
}
assertion {
type = "statusCode"
Expand All @@ -23,11 +23,42 @@ resource "datadog_synthetics_test" "mirrors_jenkins_io" {
status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkins_io_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://mirrors.jenkins.io"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://mirrors.jenkins.io"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "mirrors.jenkins.io-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins.io",
"production"
]

status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkinsci_org" {
type = "api"
request_definition {
method = "GET"
url = "https://mirrors.jenkins-ci.org"
url = "https://mirrors.jenkins-ci.org/debian/jenkins_2.251_all.deb?mirrorlist"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this version have to be updated in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope: a given version must always be available through the mirrors.
The idea is to monitor the whole service (e.g. "does it work as expected?") and not only the HTTP answer. By providing a full URL to an existing file, with the query string parameter mirrorlist, then we expect the HTTP/200 page.
Since mirrorbits does not have the file itself (it is expected to answer an HTTP/3XX redirect to a mirror), an HTTP/200 only means that we have the full-featured service.

=> this was the behavior of the monitor on get.jenkins.io, so this change is to make it coherent (as the 3 domains get.jenkins.io, mirrors.jenkins.io and mirrors.jenkins-ci.org are pointing towards the same service)

}
assertion {
type = "statusCode"
Expand All @@ -47,3 +78,34 @@ resource "datadog_synthetics_test" "mirrors_jenkinsci_org" {

status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkinsci_org_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://mirrors.jenkins-ci.org"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://mirrors.jenkins-ci.org"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "mirrors.jenkins-ci.org-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins-ci.org",
"production"
]

status = "live"
}
2 changes: 1 addition & 1 deletion synthetics_wiki.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resource "datadog_synthetics_test" "wikijenkins_ciorg" {
operator = "is"
target = "200"
}

locations = ["aws:eu-central-1"]
# Can't work at the moment according datadog message
# Synthetics is only available for the Datadog US site.
Expand Down