Skip to content

Commit

Permalink
Fix multi-platform builds with multiple aliases. (#1651)
Browse files Browse the repository at this point in the history
Multi-platform builds append a `-t` argument for each alias to the
`dockerBuildOptions`, but the `publishTask` function was ALWAYS
iterating over the aliases even if it was a multi-platform build.

The consequence was attempts to buildx and push the tags multiple times.
In some environments this leads to build failures because you can't push
the same tag twice.

This change simply does not iterate over the aliases for multiplatform builds.
  • Loading branch information
zarthross authored Nov 25, 2024
1 parent e56794d commit c882ac2
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,12 @@ object DockerPlugin extends AutoPlugin {
"--push"
) ++ dockerBuildOptions.value :+ "."
else dockerExecCommand.value
alias.foreach { aliasValue =>
publishDocker(context, execCommand, aliasValue.toString, log, multiplatform)
}
// For multiplatform builds, the alias are part of the `dockerBuildOptions` already.
if (multiplatform) publishDocker(context, execCommand, dockerAlias.value.tag.getOrElse(""), log, multiplatform)
else
alias.foreach { aliasValue =>
publishDocker(context, execCommand, aliasValue.toString, log, multiplatform)
}
} tag (Tags.Network, Tags.Publish)

def cleanTask =
Expand Down

0 comments on commit c882ac2

Please sign in to comment.