diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..135d16b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,20 @@ +image: hashicorp/terraform:full + +stages: + - test + +test_auto_update: + stage: test + script: + - apk update + - apk upgrade + - apk add --no-cache bash git grep coreutils curl + - curl -Lo /usr/local/bin/terraform-docs "https://github.com/$(curl -s https://github.com/segmentio/terraform-docs/releases | grep terraform-docs-v0.4.0-linux-amd | head -n 1 | cut -d '"' -f 2)" + - chmod +x /usr/local/bin/terraform-docs + - ./scripts/auto_update.sh ./ + - git status + - git diff --exit-code + tags: + - default + - cloudnative + diff --git a/README.md b/README.md index 0909705..3e61f84 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# DataDog Monitors # +# DataDog Monitors [![pipeline status](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/badges/master/pipeline.svg)](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/commits/master) # This repository is used to store all our monitors templates ready to use for generic purpose. + ### How to contribute ? ### First, you may refresh your knowledge and look at the [terminology](https://confluence.fr.clara.net/display/DAT/Getting+started). diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml deleted file mode 100644 index 196bcdb..0000000 --- a/bitbucket-pipelines.yml +++ /dev/null @@ -1,15 +0,0 @@ -image: hashicorp/terraform:full - -pipelines: - default: - - step: - name: Check auto update - script: - - apk update - - apk upgrade - - apk add --no-cache bash git grep coreutils curl - - curl -Lo /usr/local/bin/terraform-docs "https://github.com/$(curl -s https://github.com/segmentio/terraform-docs/releases | grep terraform-docs-v0.4.0-linux-amd | head -n 1 | cut -d '"' -f 2)" - - chmod +x /usr/local/bin/terraform-docs - - ./scripts/auto_update.sh - - git status - - git diff --exit-code diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index ae2b4d0..f11cbd2 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -11,7 +11,6 @@ for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors > outputs.tf # loop over monitors for each set for monitor in $(grep 'resource "datadog_monitor"' $(basename $path) | awk '{print $3}' | tr -d '"' ); do - echo $monitor # create output block for current monitor cat >> outputs.tf <> /dev/null 2>&1 terraform validate --check-variables=false ${dir} done