forked from GSA/grace-ansible-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
129 lines (129 loc) · 3.93 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
version: 2
jobs:
validate_terraform:
environment:
AWS_REGION: us-east-1
docker:
- image: hashicorp/terraform:light
steps:
- checkout
- run:
name: Install curl
command: apk add --update curl && apk upgrade
- run:
name: Touch release zip
command: mkdir -p release/; touch release/grace-ansible-lambda.zip
- run:
name: terraform init
command: find . -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (cd "$m" && terraform init -input=false -backend=false) || exit 1; done
- run:
name: Validate Terraform configurations
command: find . -name ".terraform" -prune -o -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (cd "$m" && terraform validate && echo "√ $m") || exit 1 ; done
- run:
name: Check if Terraform configurations are properly formatted
command: if [[ -n "$(terraform fmt -write=false)" ]]; then echo "Some terraform files need be formatted, run 'terraform fmt' to fix"; exit 1; fi
- run:
name: Install tflint
command: curl -L -o /tmp/tflint.zip https://github.com/terraform-linters/tflint/releases/download/v0.13.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin
- run:
name: Check Terraform configurations with tflint
command: find . -name ".terraform" -prune -o -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (cd "$m" && tflint && echo "√ $m") || exit 1 ; done
lint_lambda:
environment:
AWS_REGION: us-east-1
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-lambda
steps:
- checkout
- run:
name: Lint Lambda
command: make lint_lambda
test_lambda:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-lambda
steps:
- checkout
- run:
name: Run Unit Tests
command: make test_lambda
release_lambda:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-lambda
steps:
- checkout
- run:
name: Release Lambda
command: make release_lambda
- persist_to_workspace:
root: .
paths:
- ./release/*
lint_runner:
environment:
AWS_REGION: us-east-1
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-runner
steps:
- checkout
- run:
name: Lint Runner
command: make lint_runner
test_runner:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-runner
steps:
- checkout
- run:
name: Run Unit Tests
command: make test_runner
release_runner:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-ansible-runner
steps:
- checkout
- run:
name: Release Runner
command: make release_runner
- persist_to_workspace:
root: .
paths:
- ./release/*
tfsec:
docker:
- image: circleci/golang:latest
steps:
- checkout
- run:
name: Install tfsec
command: env GO111MODULE=on go get -u github.com/liamg/tfsec/cmd/tfsec
- run:
name: Terraform static code analysis with tfsec
command: tfsec
workflows:
version: 2
build:
jobs:
- validate_terraform
- tfsec
- lint_lambda
- test_lambda
- release_lambda:
filters:
tags:
only: /^v.*/
branches:
only: master
- lint_runner
- test_runner
- release_lambda:
filters:
tags:
only: /^v.*/
branches:
only: master