Commit 84be71d3 authored by Christopher Harm's avatar Christopher Harm

Adding push-only for ci build command

parent b6199282
Pipeline #56604 passed with stages
in 1 minute and 7 seconds
......@@ -74,6 +74,14 @@ func init() {
if err != nil {
panic("invalid arg")
}
ciBuildCmd.Flags().Bool("push-only", false, "skip the build step and just push")
viper.SetDefault("push.only", false)
err = viper.BindPFlag("push.only", ciBuildCmd.Flags().Lookup("push-only"))
if err != nil {
panic("invalid arg")
}
}
func buildCiDocker(config config.Config) error {
......@@ -97,10 +105,12 @@ func buildCiDocker(config config.Config) error {
fmt.Println(dockerRootDir)
}
color.New(color.FgGreen).Printf("Building: %s\n", dockerTag)
err := environment.Run(true, "docker", "build", "-t", dockerTag, "-f", dockerfile, dockerRootDir)
if err != nil {
return err
if !viper.GetBool("push.only") {
color.New(color.FgGreen).Printf("Building: %s\n", dockerTag)
err := environment.Run(true, "docker", "build", "-t", dockerTag, "-f", dockerfile, dockerRootDir)
if err != nil {
return err
}
}
if viper.GetBool("tag.latest") {
......@@ -112,7 +122,7 @@ func buildCiDocker(config config.Config) error {
}
color.New(color.FgGreen).Printf("Pushing Docker image: %s\n", dockerTag)
err = environment.Run(true, "docker", "push", dockerImage)
err := environment.Run(true, "docker", "push", dockerImage)
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment