File tree 4 files changed +23
-5
lines changed
4 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ if [[ ! "$(plugin_read_config SKIP_PULL "false")" == "true" ]] ; then
115
115
build_params+=(--pull)
116
116
fi
117
117
118
+ if [[ -n " $( plugin_read_config BUILDER_NAME " " ) " ]] && [[ " $( plugin_read_config BUILDER_USE " false" ) " == " true" ]]; then
119
+ build_params+=(" --builder" " $( plugin_read_config BUILDER_NAME " " ) " )
120
+ fi
121
+
118
122
if [[ " $( plugin_read_config NO_CACHE " false" ) " == " true" ]] ; then
119
123
build_params+=(--no-cache)
120
124
fi
Original file line number Diff line number Diff line change 73
73
if [[ " ${builder_use} " == " true" ]]; then
74
74
if builder_instance_exists " ${builder_name} " ; then
75
75
echo " ~~~ :docker: Using Builder Instance '${builder_name} '"
76
- docker buildx use " ${builder_name} "
77
76
else
78
77
echo " +++ 🚨 Builder Instance '${builder_name} ' does not exist"
79
78
exit 1
Original file line number Diff line number Diff line change @@ -31,6 +31,22 @@ setup_file() {
31
31
unstub docker
32
32
}
33
33
34
+ @test " Build with builder" {
35
+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILD=myservice
36
+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_NAME=mybuilder
37
+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_USE=true
38
+
39
+ stub docker \
40
+ " compose -f docker-compose.yml -p buildkite1111 build --pull --builder mybuilder myservice : echo built myservice"
41
+
42
+ run " $PWD " /hooks/command
43
+
44
+ assert_success
45
+ assert_output --partial " built myservice"
46
+
47
+ unstub docker
48
+ }
49
+
34
50
@test " Build with no-cache" {
35
51
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILD=myservice
36
52
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_NO_CACHE=true
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ load '../lib/shared'
105
105
assert_success
106
106
assert_output --partial " ~~~ :docker: Creating Builder Instance 'builder-name' with Driver 'docker-container'"
107
107
assert_output --partial " ~~~ :warning: Builder Instance 'builder-name' created but will not be used as 'use: true' parameter not specified"
108
-
108
+
109
109
assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
110
110
111
111
unstub docker
@@ -131,8 +131,7 @@ load '../lib/shared'
131
131
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_NAME=builder-name
132
132
133
133
stub docker \
134
- " buildx inspect builder-name : exit 0" \
135
- " buildx use builder-name : exit 0"
134
+ " buildx inspect builder-name : exit 0"
136
135
137
136
run " $PWD " /hooks/pre-command
138
137
@@ -198,7 +197,7 @@ load '../lib/shared'
198
197
199
198
assert_success
200
199
assert_output " ~~~ :docker: Cleaning up Builder Instance 'builder-name'"
201
-
200
+
202
201
unstub docker
203
202
}
204
203
You can’t perform that action at this time.
0 commit comments