File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ if [[ "${builder_create}" == "true" ]]; then
62
62
63
63
echo " ~~~ :docker: Creating Builder Instance '${builder_name} ' with Driver '${build_driver} '"
64
64
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
65
68
else
66
69
echo " ~~~ :docker: Not Creating Builder Instance '${builder_name} ' as already exists"
67
70
fi
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ load '../lib/shared'
65
65
assert_success
66
66
assert_output --partial " ~~~ :docker: Creating Builder Instance 'builder-name' with Driver 'docker-container'"
67
67
assert_output --partial " ~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
68
+
69
+ unstub docker
68
70
}
69
71
70
72
@test " Create Builder Instance with valid Driver but already Exists" {
@@ -82,6 +84,31 @@ load '../lib/shared'
82
84
assert_success
83
85
assert_output --partial " ~~~ :docker: Not Creating Builder Instance 'builder-name' as already exists"
84
86
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
85
112
}
86
113
87
114
@test " Use Builder Instance that does not Exist" {
You can’t perform that action at this time.
0 commit comments