UseDefaultTag for skip build if not default branch.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -246,11 +246,19 @@ func run(c *cli.Context) error {
|
||||
}
|
||||
|
||||
if c.Bool("tags.auto") {
|
||||
plugin.Build.Tags = docker.DefaultTagSuffix(
|
||||
if docker.UseDefaultTag( // return true if not default branch, or not tag
|
||||
c.String("commit.ref"),
|
||||
c.String("repo.branch"),
|
||||
c.String("tags.suffix"),
|
||||
)
|
||||
) {
|
||||
plugin.Build.Tags = docker.DefaultTagSuffix(
|
||||
c.String("commit.ref"),
|
||||
c.String("tags.suffix"),
|
||||
)
|
||||
} else {
|
||||
logrus.Printf("skipping automated docker build for %s", c.String("commit.ref"))
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return plugin.Exec()
|
||||
|
||||
Reference in New Issue
Block a user