mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-14 05:12:27 +08:00
Compare commits
1 Commits
v1.13.4
...
v1.11.5-debug
| Author | SHA1 | Date | |
|---|---|---|---|
| ae79bd9d1b |
@@ -22,6 +22,7 @@ import (
|
|||||||
kaniko "github.com/drone/drone-kaniko"
|
kaniko "github.com/drone/drone-kaniko"
|
||||||
"github.com/drone/drone-kaniko/pkg/artifact"
|
"github.com/drone/drone-kaniko/pkg/artifact"
|
||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
|
"github.com/drone/drone-kaniko/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -98,6 +99,17 @@ func main() {
|
|||||||
Usage: "build args",
|
Usage: "build args",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS",
|
EnvVar: "PLUGIN_BUILD_ARGS",
|
||||||
},
|
},
|
||||||
|
cli.GenericFlag{
|
||||||
|
Name: "args-new",
|
||||||
|
Usage: "build args new",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
|
Value: new(utils.CustomStringSliceFlag),
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "plugin-multiple-build-agrs",
|
||||||
|
Usage: "plugin multiple build agrs",
|
||||||
|
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "target",
|
Name: "target",
|
||||||
Usage: "build target",
|
Usage: "build target",
|
||||||
@@ -432,6 +444,8 @@ func run(c *cli.Context) error {
|
|||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
|
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
|
||||||
|
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
kaniko "github.com/drone/drone-kaniko"
|
kaniko "github.com/drone/drone-kaniko"
|
||||||
"github.com/drone/drone-kaniko/pkg/artifact"
|
"github.com/drone/drone-kaniko/pkg/artifact"
|
||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
|
"github.com/drone/drone-kaniko/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -102,6 +103,17 @@ func main() {
|
|||||||
Usage: "build args",
|
Usage: "build args",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS",
|
EnvVar: "PLUGIN_BUILD_ARGS",
|
||||||
},
|
},
|
||||||
|
cli.GenericFlag{
|
||||||
|
Name: "args-new",
|
||||||
|
Usage: "build args new",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
|
Value: new(utils.CustomStringSliceFlag),
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "plugin-multiple-build-agrs",
|
||||||
|
Usage: "plugin multiple build agrs",
|
||||||
|
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "target",
|
Name: "target",
|
||||||
Usage: "build target",
|
Usage: "build target",
|
||||||
@@ -239,6 +251,7 @@ func main() {
|
|||||||
Usage: "Enable or disable compressed caching.",
|
Usage: "Enable or disable compressed caching.",
|
||||||
EnvVar: "PLUGIN_COMPRESSED_CACHING",
|
EnvVar: "PLUGIN_COMPRESSED_CACHING",
|
||||||
},
|
},
|
||||||
|
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "context-sub-path",
|
Name: "context-sub-path",
|
||||||
Usage: "Sub-path within the context to build.",
|
Usage: "Sub-path within the context to build.",
|
||||||
@@ -349,6 +362,11 @@ func main() {
|
|||||||
Usage: "Ignore the /var/run directory during build.",
|
Usage: "Ignore the /var/run directory during build.",
|
||||||
EnvVar: "PLUGIN_IGNORE_VAR_RUN",
|
EnvVar: "PLUGIN_IGNORE_VAR_RUN",
|
||||||
},
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "args",
|
||||||
|
Usage: "build args",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "ignore-path",
|
Name: "ignore-path",
|
||||||
Usage: "Path to ignore during the build.",
|
Usage: "Path to ignore during the build.",
|
||||||
@@ -421,6 +439,8 @@ func run(c *cli.Context) error {
|
|||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
|
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
|
||||||
|
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: buildRepo(c.String("registry"), c.String("repo"), c.Bool("expand-repo")),
|
Repo: buildRepo(c.String("registry"), c.String("repo"), c.Bool("expand-repo")),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
kaniko "github.com/drone/drone-kaniko"
|
kaniko "github.com/drone/drone-kaniko"
|
||||||
"github.com/drone/drone-kaniko/pkg/artifact"
|
"github.com/drone/drone-kaniko/pkg/artifact"
|
||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
|
"github.com/drone/drone-kaniko/pkg/utils"
|
||||||
"github.com/google/go-containerregistry/pkg/authn"
|
"github.com/google/go-containerregistry/pkg/authn"
|
||||||
"github.com/google/go-containerregistry/pkg/crane"
|
"github.com/google/go-containerregistry/pkg/crane"
|
||||||
)
|
)
|
||||||
@@ -132,7 +133,7 @@ func main() {
|
|||||||
Name: "args-new",
|
Name: "args-new",
|
||||||
Usage: "build args new",
|
Usage: "build args new",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
Value: new(CustomStringSliceFlag),
|
Value: new(utils.CustomStringSliceFlag),
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "plugin-multiple-build-agrs",
|
Name: "plugin-multiple-build-agrs",
|
||||||
@@ -504,7 +505,7 @@ func run(c *cli.Context) error {
|
|||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
ArgsNew: c.Generic("args-new").(*CustomStringSliceFlag).GetValue(),
|
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
|
||||||
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import (
|
|||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
"github.com/google/go-containerregistry/pkg/authn"
|
"github.com/google/go-containerregistry/pkg/authn"
|
||||||
"github.com/google/go-containerregistry/pkg/crane"
|
"github.com/google/go-containerregistry/pkg/crane"
|
||||||
|
"github.com/drone/drone-kaniko/pkg/utils"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -96,6 +98,17 @@ func main() {
|
|||||||
Usage: "build args",
|
Usage: "build args",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS",
|
EnvVar: "PLUGIN_BUILD_ARGS",
|
||||||
},
|
},
|
||||||
|
cli.GenericFlag{
|
||||||
|
Name: "args-new",
|
||||||
|
Usage: "build args new",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
|
Value: new(utils.CustomStringSliceFlag),
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "plugin-multiple-build-agrs",
|
||||||
|
Usage: "plugin multiple build agrs",
|
||||||
|
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "target",
|
Name: "target",
|
||||||
Usage: "build target",
|
Usage: "build target",
|
||||||
@@ -401,6 +414,8 @@ func run(c *cli.Context) error {
|
|||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
|
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
|
||||||
|
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
kaniko "github.com/drone/drone-kaniko"
|
kaniko "github.com/drone/drone-kaniko"
|
||||||
"github.com/drone/drone-kaniko/pkg/artifact"
|
"github.com/drone/drone-kaniko/pkg/artifact"
|
||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
|
"github.com/drone/drone-kaniko/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -333,6 +334,18 @@ func main() {
|
|||||||
Usage: "Number of retries for downloading base images.",
|
Usage: "Number of retries for downloading base images.",
|
||||||
EnvVar: "PLUGIN_IMAGE_DOWNLOAD_RETRY",
|
EnvVar: "PLUGIN_IMAGE_DOWNLOAD_RETRY",
|
||||||
},
|
},
|
||||||
|
cli.GenericFlag{
|
||||||
|
Name: "args-new",
|
||||||
|
Usage: "build args new",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
|
Value: new(utils.CustomStringSliceFlag),
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "plugin-multiple-build-agrs",
|
||||||
|
Usage: "plugin multiple build agrs",
|
||||||
|
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
@@ -10,6 +10,7 @@ type CustomStringSliceFlag struct {
|
|||||||
Value []string
|
Value []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetValue returns the slice of strings stored in the flag
|
||||||
func (f *CustomStringSliceFlag) GetValue() []string {
|
func (f *CustomStringSliceFlag) GetValue() []string {
|
||||||
if f.Value == nil {
|
if f.Value == nil {
|
||||||
return make([]string, 0)
|
return make([]string, 0)
|
||||||
@@ -17,6 +18,7 @@ func (f *CustomStringSliceFlag) GetValue() []string {
|
|||||||
return f.Value
|
return f.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a string representation of the flag
|
||||||
func (f *CustomStringSliceFlag) String() string {
|
func (f *CustomStringSliceFlag) String() string {
|
||||||
if f.Value == nil {
|
if f.Value == nil {
|
||||||
return ""
|
return ""
|
||||||
@@ -24,6 +26,7 @@ func (f *CustomStringSliceFlag) String() string {
|
|||||||
return strings.Join(f.Value, ";")
|
return strings.Join(f.Value, ";")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set sets the value of the flag from a string
|
||||||
func (f *CustomStringSliceFlag) Set(v string) error {
|
func (f *CustomStringSliceFlag) Set(v string) error {
|
||||||
for _, s := range strings.Split(v, ";") {
|
for _, s := range strings.Split(v, ";") {
|
||||||
s = strings.TrimSpace(s)
|
s = strings.TrimSpace(s)
|
||||||
Reference in New Issue
Block a user