mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-22 20:20:39 +00:00
Merge pull request #17 from x-cray/add-force-option
Add option to replace existing matched image tags
This commit is contained in:
commit
32e388f871
1
DOCS.md
1
DOCS.md
@ -7,6 +7,7 @@ The following parameters are used to configure this plugin:
|
|||||||
* `email` - authenticates with this email
|
* `email` - authenticates with this email
|
||||||
* `repo` - repository name for the image
|
* `repo` - repository name for the image
|
||||||
* `tag` - repository tag for the image
|
* `tag` - repository tag for the image
|
||||||
|
* `force_tag` - replace existing matched image tags
|
||||||
* `insecure` - enable insecure communication to this registry
|
* `insecure` - enable insecure communication to this registry
|
||||||
* `mirror` - use a mirror registry instead of pulling images directly from the central Hub
|
* `mirror` - use a mirror registry instead of pulling images directly from the central Hub
|
||||||
* `storage_driver` - use `aufs`, `devicemapper`, `btrfs` or `overlay` driver
|
* `storage_driver` - use `aufs`, `devicemapper`, `btrfs` or `overlay` driver
|
||||||
|
7
main.go
7
main.go
@ -29,6 +29,7 @@ type Docker struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Auth string `json:"auth"`
|
Auth string `json:"auth"`
|
||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
|
ForceTag bool `json:"force_tag"`
|
||||||
Tag StrSlice `json:"tag"`
|
Tag StrSlice `json:"tag"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Context string `json:"context"`
|
Context string `json:"context"`
|
||||||
@ -183,7 +184,11 @@ func main() {
|
|||||||
// Creates image tags
|
// Creates image tags
|
||||||
for _, tag := range vargs.Tag.Slice()[1:] {
|
for _, tag := range vargs.Tag.Slice()[1:] {
|
||||||
name_ := fmt.Sprintf("%s:%s", vargs.Repo, tag)
|
name_ := fmt.Sprintf("%s:%s", vargs.Repo, tag)
|
||||||
cmd = exec.Command("/usr/bin/docker", "tag", name, name_)
|
cmd = exec.Command("/usr/bin/docker", "tag")
|
||||||
|
if vargs.ForceTag {
|
||||||
|
cmd.Args = append(cmd.Args, "--force=true")
|
||||||
|
}
|
||||||
|
cmd.Args = append(cmd.Args, name, name_)
|
||||||
cmd.Dir = workspace.Path
|
cmd.Dir = workspace.Path
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user