Merge pull request #160 from appleboy/defalut

keep only master branch for latest
This commit is contained in:
Brad Rydzewski
2017-11-09 13:17:00 -08:00
committed by GitHub
3 changed files with 102 additions and 3 deletions

View File

@@ -192,6 +192,11 @@ func main() {
Usage: "docker email",
EnvVar: "PLUGIN_EMAIL,DOCKER_EMAIL",
},
cli.StringFlag{
Name: "repo.branch",
Usage: "repository default branch",
EnvVar: "DRONE_REPO_BRANCH",
},
}
if err := app.Run(os.Args); err != nil {
@@ -240,10 +245,19 @@ func run(c *cli.Context) error {
}
if c.Bool("tags.auto") {
plugin.Build.Tags = docker.DefaultTagSuffix(
if docker.UseDefaultTag( // return true if tag event or default branch
c.String("commit.ref"),
c.String("tags.suffix"),
)
c.String("repo.branch"),
) {
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()