Merge branch 'MON-336_Convert_bitbucket_pipeline_to_gitlab_ci' into 'master'

Resolve MON-336 "Convert bitbucket pipeline to gitlab ci"

Closes MON-336

See merge request claranet/cloudnative/projects/datadog/terraform/monitors!5
This commit is contained in:
Quentin Manfroi 2018-10-25 11:52:03 +02:00
commit d9cc2f99a8
5 changed files with 23 additions and 18 deletions

20
.gitlab-ci.yml Normal file
View File

@ -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

View File

@ -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. This repository is used to store all our monitors templates ready to use for generic purpose.
### How to contribute ? ### ### How to contribute ? ###
First, you may refresh your knowledge and look at the [terminology](https://confluence.fr.clara.net/display/DAT/Getting+started). First, you may refresh your knowledge and look at the [terminology](https://confluence.fr.clara.net/display/DAT/Getting+started).

View File

@ -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

View File

@ -11,7 +11,6 @@ for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors
> outputs.tf > outputs.tf
# loop over monitors for each set # loop over monitors for each set
for monitor in $(grep 'resource "datadog_monitor"' $(basename $path) | awk '{print $3}' | tr -d '"' ); do for monitor in $(grep 'resource "datadog_monitor"' $(basename $path) | awk '{print $3}' | tr -d '"' ); do
echo $monitor
# create output block for current monitor # create output block for current monitor
cat >> outputs.tf <<EOF cat >> outputs.tf <<EOF
output "${monitor}_id" { output "${monitor}_id" {

View File

@ -6,7 +6,7 @@ goto_root
for path in $(find "$(get_scope $1)" -path ./testing -prune -o -path ./incubator -prune -o -name 'inputs.tf' -print); do for path in $(find "$(get_scope $1)" -path ./testing -prune -o -path ./incubator -prune -o -name 'inputs.tf' -print); do
dir=$(dirname ${path}) dir=$(dirname ${path})
terraform init ${dir} terraform init ${dir} >> /dev/null 2>&1
terraform validate --check-variables=false ${dir} terraform validate --check-variables=false ${dir}
done done