1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ # Please note that this file was generated from [terraform-google-module-template](https://github.com/terraform-google-modules/terraform-google-module-template).
16+ # Please make sure to contribute relevant changes upstream!
17+
1518# Make will use bash instead of sh
1619SHELL := /usr/bin/env bash
1720
21+ # Docker build config variables
22+ CREDENTIALS_PATH ?= /cft/workdir/credentials.json
23+
24+
25+ # Docker build config variables
26+ DOCKER_ORG := gcr.io/cloud-foundation-cicd
27+ DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 1.0.1
28+ DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM}
29+
1830# All is the first target in the file so it will get picked up when you just run 'make' on its own
19- all : check_shell check_python check_golang check_terraform check_docker check_base_files check_trailing_whitespace generate_docs
31+ all : check generate_docs
32+
33+ # Run all available linters
34+ check : check_shell check_python check_golang check_terraform check_docker check_base_files test_check_headers check_headers check_trailing_whitespace
2035
2136# The .PHONY directive tells make that this isn't a real target and so
2237# the presence of a file named 'check_shell' won't cause this target to stop
@@ -45,26 +60,90 @@ check_docker:
4560check_base_files :
4661 @source test/make.sh && basefiles
4762
48- .PHONY : check_shebangs
49- check_shebangs :
50- @source test/make.sh && check_bash
51-
5263.PHONY : check_trailing_whitespace
5364check_trailing_whitespace :
5465 @source test/make.sh && check_trailing_whitespace
5566
5667.PHONY : test_check_headers
5768test_check_headers :
69+ @echo " Testing the validity of the header check"
5870 @python test/test_verify_boilerplate.py
5971
6072.PHONY : check_headers
6173check_headers :
62- @python test/verify_boilerplate.py
74+ @source test/make.sh && check_headers
75+
76+ # Integration tests
77+ .PHONY : test_integration
78+ test_integration :
79+ test/ci_integration.sh
6380
6481.PHONY : generate_docs
6582generate_docs :
6683 @source test/make.sh && generate_docs
6784
68- .PHONY : test_integration
69- test_integration :
70- @source test/test.sh
85+ # Versioning
86+ .PHONY : version
87+ version :
88+ @source helpers/version-repo.sh
89+
90+ # Run docker
91+ .PHONY : docker_run
92+ docker_run :
93+ docker run --rm -it \
94+ -e PROJECT_ID \
95+ -e SERVICE_ACCOUNT_JSON \
96+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
97+ -v $(CURDIR ) :/cft/workdir \
98+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
99+ /bin/bash -c " source test/ci_integration.sh && setup_environment && exec /bin/bash"
100+
101+ .PHONY : docker_create
102+ docker_create :
103+ docker run --rm -it \
104+ -e PROJECT_ID \
105+ -e SERVICE_ACCOUNT_JSON \
106+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
107+ -v $(CURDIR ) :/cft/workdir \
108+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
109+ /bin/bash -c " source test/ci_integration.sh && setup_environment && kitchen create"
110+
111+ .PHONY : docker_converge
112+ docker_converge :
113+ docker run --rm -it \
114+ -e PROJECT_ID \
115+ -e SERVICE_ACCOUNT_JSON \
116+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
117+ -v $(CURDIR ) :/cft/workdir \
118+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
119+ /bin/bash -c " source test/ci_integration.sh && setup_environment && kitchen converge"
120+
121+ .PHONY : docker_verify
122+ docker_verify :
123+ docker run --rm -it \
124+ -e PROJECT_ID \
125+ -e SERVICE_ACCOUNT_JSON \
126+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
127+ -v $(CURDIR ) :/cft/workdir \
128+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
129+ /bin/bash -c " source test/ci_integration.sh && setup_environment && kitchen verify"
130+
131+ .PHONY : docker_destroy
132+ docker_destroy :
133+ docker run --rm -it \
134+ -e PROJECT_ID \
135+ -e SERVICE_ACCOUNT_JSON \
136+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
137+ -v $(CURDIR ) :/cft/workdir \
138+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
139+ /bin/bash -c " source test/ci_integration.sh && setup_environment && kitchen destroy"
140+
141+ .PHONY : test_integration_docker
142+ test_integration_docker :
143+ docker run --rm -it \
144+ -e PROJECT_ID \
145+ -e SERVICE_ACCOUNT_JSON \
146+ -e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
147+ -v $(CURDIR ) :/cft/workdir \
148+ ${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
149+ make test_integration
0 commit comments