add flag --no-push (#21)
This commit is contained in:
parent
df81f82f84
commit
e65b7b3ada
@ -127,6 +127,11 @@ func main() {
|
|||||||
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
||||||
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "no-push",
|
||||||
|
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
|
||||||
|
EnvVar: "PLUGIN_NO_PUSH",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -155,6 +160,7 @@ func run(c *cli.Context) error {
|
|||||||
CacheRepo: c.String("cache-repo"),
|
CacheRepo: c.String("cache-repo"),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
|
NoPush: c.Bool("no-push"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
|
@ -117,6 +117,11 @@ func main() {
|
|||||||
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
||||||
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "no-push",
|
||||||
|
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
|
||||||
|
EnvVar: "PLUGIN_NO_PUSH",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -144,6 +149,7 @@ func run(c *cli.Context) error {
|
|||||||
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
|
NoPush: c.Bool("no-push"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
|
@ -113,6 +113,11 @@ func main() {
|
|||||||
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
||||||
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "no-push",
|
||||||
|
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
|
||||||
|
EnvVar: "PLUGIN_NO_PUSH",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -144,6 +149,7 @@ func run(c *cli.Context) error {
|
|||||||
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
|
NoPush: c.Bool("no-push"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
|
@ -26,6 +26,7 @@ type (
|
|||||||
CacheRepo string // Remote repository that will be used to store cached layers
|
CacheRepo string // Remote repository that will be used to store cached layers
|
||||||
CacheTTL int // Cache timeout in hours
|
CacheTTL int // Cache timeout in hours
|
||||||
DigestFile string // Digest file location
|
DigestFile string // Digest file location
|
||||||
|
NoPush bool // Set this flag if you only want to build the image, without pushing to a registry
|
||||||
}
|
}
|
||||||
// Artifact defines content of artifact file
|
// Artifact defines content of artifact file
|
||||||
Artifact struct {
|
Artifact struct {
|
||||||
@ -34,7 +35,6 @@ type (
|
|||||||
Registry string // Docker artifact registry
|
Registry string // Docker artifact registry
|
||||||
RegistryType artifact.RegistryTypeEnum // Rocker artifact registry type
|
RegistryType artifact.RegistryTypeEnum // Rocker artifact registry type
|
||||||
ArtifactFile string // Artifact file location
|
ArtifactFile string // Artifact file location
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@ -100,6 +100,10 @@ func (p Plugin) Exec() error {
|
|||||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--digest-file=%s", p.Build.DigestFile))
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--digest-file=%s", p.Build.DigestFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Build.NoPush {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--no-push"))
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user