File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ func (p Plugin) Exec() error {
164164 }
165165 }
166166
167+ // otherwise there is a possibility of parallel plugin execution in the same CI build
168+ // resulting in different images having the same contents
169+ setUniqueBuildName (& p .Build )
170+
167171 if p .Build .Squash && ! p .Daemon .Experimental {
168172 fmt .Println ("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring..." )
169173 p .Build .Squash = false
@@ -374,6 +378,12 @@ func commandBuild(build Build) *exec.Cmd {
374378 return exec .Command (dockerExe , args ... )
375379}
376380
381+ func setUniqueBuildName (build * Build ) {
382+ shortenCommitSHA := build .Name [0 :8 ]
383+ imageName := build .Repo [strings .LastIndex (build .Repo , "/" )+ 1 : len (build .Repo )]
384+ build .Name = fmt .Sprintf ("%s-%s" , imageName , & shortenCommitSHA )
385+ }
386+
377387func getSecretStringCmdArg (kvp string ) (string , error ) {
378388 return getSecretCmdArg (kvp , false )
379389}
You can’t perform that action at this time.
0 commit comments