File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ if [[ ! "$(plugin_read_config SKIP_PULL "false")" == "true" ]] ; then
115115 build_params+=(--pull)
116116fi
117117
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+
118122if [[ " $( plugin_read_config NO_CACHE " false" ) " == " true" ]] ; then
119123 build_params+=(--no-cache)
120124fi
Original file line number Diff line number Diff line change 7373if [[ " ${builder_use} " == " true" ]]; then
7474 if builder_instance_exists " ${builder_name} " ; then
7575 echo " ~~~ :docker: Using Builder Instance '${builder_name} '"
76- docker buildx use " ${builder_name} "
7776 else
7877 echo " +++ 🚨 Builder Instance '${builder_name} ' does not exist"
7978 exit 1
Original file line number Diff line number Diff line change @@ -31,6 +31,22 @@ setup_file() {
3131 unstub docker
3232}
3333
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+
3450@test " Build with no-cache" {
3551 export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILD=myservice
3652 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'
105105 assert_success
106106 assert_output --partial " ~~~ :docker: Creating Builder Instance 'builder-name' with Driver 'docker-container'"
107107 assert_output --partial " ~~~ :warning: Builder Instance 'builder-name' created but will not be used as 'use: true' parameter not specified"
108-
108+
109109 assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
110110
111111 unstub docker
@@ -131,8 +131,7 @@ load '../lib/shared'
131131 export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_NAME=builder-name
132132
133133 stub docker \
134- " buildx inspect builder-name : exit 0" \
135- " buildx use builder-name : exit 0"
134+ " buildx inspect builder-name : exit 0"
136135
137136 run " $PWD " /hooks/pre-command
138137
@@ -198,7 +197,7 @@ load '../lib/shared'
198197
199198 assert_success
200199 assert_output " ~~~ :docker: Cleaning up Builder Instance 'builder-name'"
201-
200+
202201 unstub docker
203202}
204203
You can’t perform that action at this time.
0 commit comments