-
Notifications
You must be signed in to change notification settings - Fork 1
/
test
executable file
·94 lines (73 loc) · 2.49 KB
/
test
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
#!/bin/bash
#
# A test script to check the docker file
#
set -exu -o pipefail
function test_latest() {
tag=latest
echo "Testing ${tag} Dockerfile"
docker run -it "milmove/circleci-docker:${tag}" shellcheck --version
docker run -it "milmove/circleci-docker:${tag}" circleci version
docker run -it "milmove/circleci-docker:${tag}" aws --version
docker run -it "milmove/circleci-docker:${tag}" chamber version
docker run -it "milmove/circleci-docker:${tag}" pre-commit --version
echo "Passed ${tag}"
}
function test_milmove_app() {
tag=milmove-app
echo "Testing ${tag} Dockerfile"
docker run -it "milmove/circleci-docker:${tag}" go version
docker run -it "milmove/circleci-docker:${tag}" node --version
docker run -it "milmove/circleci-docker:${tag}" yarn --version
docker run -it "milmove/circleci-docker:${tag}" which entr
docker run -it "milmove/circleci-docker:${tag}" psql --version
echo "Passed ${tag}"
}
function test_milmove_cypress() {
tag=milmove-cypress
echo "Testing ${tag} Dockerfile"
docker run -it "milmove/circleci-docker:${tag}" yarn cypress version
echo "Passed ${tag}"
}
function test_milmove_infra_tf132() {
tag=milmove-infra-tf132
echo "Testing ${tag} Dockerfile"
docker run -it "milmove/circleci-docker:${tag}" find-guardduty-user version
docker run -it "milmove/circleci-docker:${tag}" terraform --version
docker run -it "milmove/circleci-docker:${tag}" terraform-docs --version
docker run -it "milmove/circleci-docker:${tag}" tfsec --version
echo "Passed ${tag}"
}
function test_milmove_infra_tf112() {
tag=milmove-infra-tf112
echo "Testing ${tag} Dockerfile"
docker run -it "milmove/circleci-docker:${tag}" find-guardduty-user version
docker run -it "milmove/circleci-docker:${tag}" terraform --version
docker run -it "milmove/circleci-docker:${tag}" terraform-docs --version
docker run -it "milmove/circleci-docker:${tag}" tfsec --version
echo "Passed ${tag}"
}
for tag in latest milmove-app milmove-cypress milmove-infra-tf132 milmove-infra-tf112; do
echo
echo "* Testing USER is properly set to 'circleci' on '${tag}' tagged image"
docker run -it "milmove/circleci-docker:${tag}" bash -xc '[[ $(whoami) = circleci ]]'
case ${tag} in
latest)
test_latest
;;
milmove-app)
test_milmove_app
;;
milmove-cypress)
test_milmove_cypress
;;
milmove-infra-tf112)
test_milmove_infra_tf112
;;
milmove-infra-tf132)
test_milmove_infra_tf132
;;
esac
done
echo "Passed."
exit 0