File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,42 @@ setup() {
6666 unstub docker
6767}
6868
69+ @test " Pull image first before running BUILDKITE_COMMAND, success on retries" {
70+ export BUILDKITE_PLUGIN_DOCKER_ALWAYS_PULL=true
71+ export BUILDKITE_PLUGIN_DOCKER_PULL_RETRIES=2
72+
73+ stub docker \
74+ " pull image:tag" \
75+ " pull image:tag : echo pulled latest image on retry" \
76+ " run -t -i --rm --init --volume $PWD :/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker"
77+
78+ run " $PWD " /hooks/command
79+
80+ assert_success
81+ assert_output --partial " Retrying 1 more times..."
82+ assert_output --partial " pulled latest image on retry"
83+ assert_output --partial " ran command in docker"
84+
85+ unstub docker
86+ }
87+
88+ @test " Pull image first before running BUILDKITE_COMMAND, failure on retries" {
89+ export BUILDKITE_PLUGIN_DOCKER_ALWAYS_PULL=true
90+ export BUILDKITE_PLUGIN_DOCKER_PULL_RETRIES=2
91+
92+ stub docker \
93+ " pull image:tag" \
94+ " pull image:tag"
95+
96+ run " $PWD " /hooks/command
97+
98+ assert_failure
99+ assert_output --partial " Retrying 1 more times..."
100+ assert_output --partial " !!! :docker: Pull failed."
101+
102+ unstub docker
103+ }
104+
69105@test " Runs BUILDKITE_COMMAND with mount-buildkite-agent disabled specifically" {
70106 export BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT=false
71107 export BUILDKITE_COMMAND=" pwd"
You can’t perform that action at this time.
0 commit comments