File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ if [[ "${builder_create}" == "true" ]]; then
6262
6363 echo " ~~~ :docker: Creating Builder Instance '${builder_name} ' with Driver '${build_driver} '"
6464 docker buildx create " ${builder_instance_args[@]} "
65+ if [[ " ${builder_use} " == " false" ]]; then
66+ echo " ~~~ :warning: Builder Instance '${builder_name} ' created but will not be used as 'use: true' parameter not specified"
67+ fi
6568 else
6669 echo " ~~~ :docker: Not Creating Builder Instance '${builder_name} ' as already exists"
6770 fi
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ load '../lib/shared'
6565 assert_success
6666 assert_output --partial " ~~~ :docker: Creating Builder Instance 'builder-name' with Driver 'docker-container'"
6767 assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
68+
69+ unstub docker
6870}
6971
7072@test " Create Builder Instance with valid Driver but already Exists" {
@@ -82,6 +84,31 @@ load '../lib/shared'
8284 assert_success
8385 assert_output --partial " ~~~ :docker: Not Creating Builder Instance 'builder-name' as already exists"
8486 assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
87+
88+ unstub docker
89+ }
90+
91+ @test " Create Builder Instance with valid Driver but not used" {
92+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_CREATE=true
93+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_USE=false
94+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_NAME=builder-name
95+ export BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_DRIVER=docker-container
96+
97+ stub docker \
98+ " buildx inspect builder-name : exit 1" \
99+ " buildx create --name builder-name --driver docker-container --bootstrap : exit 0" \
100+ " buildx inspect : echo 'Name: test'" \
101+ " buildx inspect : echo 'Driver: driver'"
102+
103+ run " $PWD " /hooks/pre-command
104+
105+ assert_success
106+ assert_output --partial " ~~~ :docker: Creating Builder Instance 'builder-name' with Driver 'docker-container'"
107+ assert_output --partial " ~~~ :warning: Builder Instance 'builder-name' created but will not be used as 'use: true' parameter not specified"
108+
109+ assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
110+
111+ unstub docker
85112}
86113
87114@test " Use Builder Instance that does not Exist" {
You can’t perform that action at this time.
0 commit comments