-
Notifications
You must be signed in to change notification settings - Fork 226
/
Makefile
87 lines (78 loc) · 3.2 KB
/
Makefile
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
# Copyright 2022-2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Please note that this file was generated from [terraform-google-module-template](https://github.com/terraform-google-modules/terraform-google-module-template).
# Please make sure to contribute relevant changes upstream!
# Make will use bash instead of sh
SHELL := /usr/bin/env bash
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.22
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd
DOCKER_BIN ?= docker
# Enter docker container for local development
.PHONY: docker_run
docker_run:
$(DOCKER_BIN) run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/bin/bash
# Execute prepare tests within the docker container
.PHONY: docker_test_prepare
docker_test_prepare:
$(DOCKER_BIN) run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-e TF_VAR_org_id \
-e TF_VAR_folder_id \
-e TF_VAR_billing_account \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/usr/local/bin/execute_with_credentials.sh prepare_environment
# Clean up test environment within the docker container
.PHONY: docker_test_cleanup
docker_test_cleanup:
$(DOCKER_BIN) run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-e TF_VAR_org_id \
-e TF_VAR_folder_id \
-e TF_VAR_billing_account \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/usr/local/bin/execute_with_credentials.sh cleanup_environment
# Execute integration tests within the docker container
.PHONY: docker_test_integration
docker_test_integration:
$(DOCKER_BIN) run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/usr/local/bin/test_integration.sh
# Execute lint tests within the docker container
.PHONY: docker_test_lint
docker_test_lint:
$(DOCKER_BIN) run --rm -it \
-e ENABLE_PARALLEL=1 \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/usr/local/bin/test_lint.sh
# Execute a sample within the docker container
.PHONY: docker_test_sample
docker_test_sample:
if [ -z "$(SAMPLE)" ]; then \
echo "Please set SAMPLE variable"; \
fi
$(DOCKER_BIN) run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/bin/bash -c "cd test/integration && go test -v -timeout 0 -run //$(SAMPLE)"