@@ -12,68 +12,68 @@ source "${PROGDIR}/.util/tools.sh"
12
12
# shellcheck source=SCRIPTDIR/.util/print.sh
13
13
source " ${PROGDIR} /.util/print.sh"
14
14
15
- # shellcheck source=SCRIPTDIR/.util/git.sh
16
- source " ${PROGDIR} /.util/git.sh"
17
-
18
15
# shellcheck source=SCRIPTDIR/.util/builders.sh
19
16
source " ${PROGDIR} /.util/builders.sh"
20
17
21
18
function main() {
22
- local builderArray
19
+ local builderArray token
23
20
builderArray=()
21
+ token=" "
22
+
24
23
while [[ " ${# } " != 0 ]]; do
25
24
case " ${1} " in
26
- --use-token|-t)
25
+ --help|-h)
26
+ shift 1
27
+ usage
28
+ exit 0
29
+ ;;
30
+
31
+ --builder|-b)
32
+ builderArray+=(" ${2} " )
33
+ shift 2
34
+ ;;
35
+
36
+ --token|-t)
37
+ token=" ${2} "
38
+ shift 2
39
+ ;;
40
+
41
+ " " )
42
+ # skip if the argument is empty
27
43
shift 1
28
- token::fetch
29
44
;;
30
45
31
- --help | -h)
32
- shift 1
33
- usage
34
- exit 0
35
- ;;
36
-
37
- --builder | -b)
38
- builderArray+=(" ${2} " )
39
- shift 2
40
- ;;
41
-
42
- " " )
43
- # skip if the argument is empty
44
- shift 1
45
- ;;
46
-
47
- * )
48
- util::print::error " unknown argument \" ${1} \" "
49
- ;;
46
+ * )
47
+ util::print::error " unknown argument \" ${1} \" "
50
48
esac
51
49
done
52
50
53
51
if [[ ! -d " ${BUILDPACKDIR} /integration" ]]; then
54
- util::print::warn " ** WARNING No Integration tests **"
52
+ util::print::warn " ** WARNING No Integration tests **"
55
53
fi
56
54
57
- tools::install
55
+ tools::install " ${token} "
58
56
59
57
if [ ${# builderArray[@]} -eq 0 ]; then
60
58
util::print::title " No builders provided. Finding builders in integration.json..."
61
59
62
60
local builders
63
- builders=" $( util::builders::list " ${BUILDPACKDIR} /integration.json" | jq -r ' .[]' ) "
61
+ builders=" $( util::builders::list " ${BUILDPACKDIR} /integration.json" | jq -r ' .[]' ) "
62
+
63
+ util::print::info " Found the following builders:"
64
+ util::print::info " ${builders} "
64
65
65
66
# shellcheck disable=SC2206
66
67
IFS=$' \n ' builderArray=(${builders} )
67
68
unset IFS
68
69
fi
69
70
70
- # shellcheck disable=SC2068
71
- images::pull ${builderArray[@]}
72
-
73
71
local testout
74
72
testout=$( mktemp)
75
-
76
73
for builder in " ${builderArray[@]} " ; do
74
+ util::print::title " Getting images for builder: '${builder} '"
75
+ builder_images::pull " ${builder} "
76
+
77
77
util::print::title " Setting default pack builder image..."
78
78
pack config default-builder " ${builder} "
79
79
@@ -94,16 +94,19 @@ OPTIONS
94
94
--help -h prints the command usage
95
95
--builder <name> -b <name> sets the name of the builder(s) that are pulled / used for testing.
96
96
Defaults to "builders" array in integration.json, if present.
97
+ --token <token> Token used to download assets from GitHub (e.g. jam, pack, etc) (optional)
97
98
USAGE
98
99
}
99
100
100
101
function tools::install() {
101
102
102
103
util::tools::pack::install \
103
- --directory " ${BUILDPACKDIR} /.bin"
104
+ --directory " ${BUILDPACKDIR} /.bin" \
105
+ --token " ${token} "
104
106
105
107
util::tools::jam::install \
106
- --directory " ${BUILDPACKDIR} /.bin"
108
+ --directory " ${BUILDPACKDIR} /.bin" \
109
+ --token " ${token} "
107
110
108
111
util::tools::create-package::install \
109
112
--directory " ${BUILDPACKDIR} /.bin"
@@ -114,38 +117,37 @@ function tools::install() {
114
117
fi
115
118
}
116
119
117
- function images::pull() {
118
- for builder in " ${@ } " ; do
119
- util::print::title " Pulling builder image ${builder} ..."
120
- docker pull " ${builder} "
121
- local run_image lifecycle_image
122
- run_image=" $(
123
- pack inspect-builder " ${builder} " --output json |
124
- jq -r ' .remote_info.run_images[0].name'
125
- ) "
126
- lifecycle_image=" index.docker.io/buildpacksio/lifecycle:$(
127
- pack inspect-builder " ${builder} " --output json |
128
- jq -r ' .remote_info.lifecycle.version'
129
- ) "
130
- util::print::title " Pulling run image..."
131
- docker pull " ${run_image} "
132
-
133
- util::print::title " Pulling lifecycle image..."
134
- docker pull " ${lifecycle_image} "
135
- done
136
- }
120
+ function builder_images::pull() {
121
+ local builder
122
+ builder=" ${1} "
123
+
124
+ util::print::title " Pulling builder image ${builder} ..."
125
+ docker pull " ${builder} "
126
+
127
+ local run_image lifecycle_image
128
+ run_image=" $(
129
+ pack inspect-builder " ${builder} " --output json \
130
+ | jq -r ' .remote_info.run_images[0].name'
131
+ ) "
132
+ lifecycle_image=" index.docker.io/buildpacksio/lifecycle:$(
133
+ pack inspect-builder " ${builder} " --output json \
134
+ | jq -r ' .remote_info.lifecycle.version'
135
+ ) "
136
+
137
+ util::print::title " Pulling run image..."
138
+ docker pull " ${run_image} "
137
139
138
- function token::fetch() {
139
- GIT_TOKEN=" $( util::git::token::fetch) "
140
- export GIT_TOKEN
140
+ util::print::title " Pulling lifecycle image..."
141
+ docker pull " ${lifecycle_image} "
141
142
}
142
143
143
144
function tests::run() {
144
145
util::print::title " Run Buildpack Runtime Integration Tests"
145
146
util::print::info " Using ${1} as builder..."
146
147
148
+ export CGO_ENABLED=0
147
149
pack config experimental true
148
- pushd " ${BUILDPACKDIR} " > /dev/null
150
+ pushd " ${BUILDPACKDIR} " > /dev/null
149
151
if GOMAXPROCS=" ${GOMAXPROCS:- 4} " go test -count=1 -timeout 0 ./integration/... -v -run Integration | tee " ${2} " ; then
150
152
util::print::info " ** GO Test Succeeded with ${1} **"
151
153
else
0 commit comments