-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.ci
65 lines (58 loc) · 2.42 KB
/
Makefile.ci
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
MAKEFLAGS += --no-builtin-rules
CI_CONTAINER_IIDFILE= ./build/ci-output/container.txt
# Sets the directory to utilize as the work dir within the container
# Note that for check-generate to work, the directory must be named
# after the terraform provider due to the plugin using the base directory
# as the terraform provider's name
SRC_DIR= /src/terraform-provider-oktapam
#build the container from Dockerfile.ci
.PHONY: ci-container
ci-container:
rm -rf "./build/ci-output"
mkdir -p "./build/ci-output"
docker build -f Dockerfile.ci --iidfile ${CI_CONTAINER_IIDFILE} --build-arg APP_PATH=${SRC_DIR} .
.PHONY: ci-test
ci-test: ci-container
docker run --rm=true -a stderr -a stdout \
--label "com.buildkite.job-id=${BUILDKITE_JOB_ID}" \
-e BUILDKITE_BUILD_NUMBER \
-e BUILDKITE_PIPELINE_SLUG \
-e BUILDKITE_JOB_ID \
-v "$(CURDIR)/build/ci-output:/output" `cat ./build/ci-output/container.txt` /usr/bin/make -C ${SRC_DIR} test
.PHONY: ci-acceptance-test
ci-acceptance-test: ci-container
docker run --rm=true -a stderr -a stdout \
--label "com.buildkite.job-id=${BUILDKITE_JOB_ID}" \
-e BUILDKITE_BUILD_NUMBER \
-e BUILDKITE_PIPELINE_SLUG \
-e BUILDKITE_JOB_ID \
-e OKTAPAM_KEY \
-e OKTAPAM_SECRET \
-e OKTAPAM_TEAM \
-e OKTAPAM_API_HOST \
-e OKTAPAM_TRUSTED_DOMAIN_OVERRIDE \
-e TF_ACC_PAM \
-e TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform \
-e TF_ACC_TERRAFORM_VERSION \
-v ${TF_ACC_TERRAFORM_PATH}:/usr/local/bin/terraform \
-v "$(CURDIR)/build/ci-output:/output" `cat ./build/ci-output/container.txt` /usr/bin/make -C ${SRC_DIR} testacc
.PHONY: ci-compile
ci-compile: ci-container
docker run --rm=true -a stderr -a stdout \
--label "com.buildkite.job-id=${BUILDKITE_JOB_ID}" \
-e BUILDKITE_BUILD_NUMBER \
-e BUILDKITE_PIPELINE_SLUG \
-e BUILDKITE_JOB_ID \
-v "$(CURDIR)/build/ci-output:/output" `cat ./build/ci-output/container.txt` /usr/bin/make -C ${SRC_DIR} build
.PHONY: ci-check-generate
ci-check-generate: ci-container
docker run --rm=true -a stderr -a stdout \
--label "com.buildkite.job-id=${BUILDKITE_JOB_ID}" \
-e BUILDKITE_BUILD_NUMBER \
-e BUILDKITE_PIPELINE_SLUG \
-e BUILDKITE_JOB_ID \
-e TF_ACC_TERRAFORM_PATH \
-e TF_ACC_TERRAFORM_VERSION \
-v ${TF_ACC_TERRAFORM_PATH}:/usr/local/bin/terraform \
-v "$(CURDIR)/build/ci-output:/output" `cat ./build/ci-output/container.txt` /usr/bin/make -C ${SRC_DIR} check-generate
.PHONY: all ci-compile ci-test ci-acceptance-test ci-check-generate