Allow multible Repos (#22)

close partialy #18

we still need to handle multible registry login

Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/22
This commit is contained in:
6543 2022-09-28 15:17:39 +02:00
parent 06d32b13a5
commit 10426e6a19
4 changed files with 7 additions and 5 deletions

View File

@ -189,7 +189,7 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Usage: "enables compression og the build context using gzip",
Destination: &settings.Build.Compress,
},
&cli.StringFlag{
&cli.StringSliceFlag{
Name: "repo",
EnvVars: []string{"PLUGIN_REPO"},
Usage: "sets repository name for the image",

View File

@ -30,7 +30,7 @@ It will automatically generate buildkit configuration to use custom CA certifica
| Settings Name | Default | Description
| --------------------------| ----------------- | --------------------------------------------
| `dry-run` | `false` | disables docker push
| `repo` | *none* | sets repository name for the image
| `repo` | *none* | sets repository name for the image (can be a list)
| `username` | *none* | sets username to authenticates with
| `password` | *none* | sets password / token to authenticates with
| `email` | *none* | sets email address to authenticates with

View File

@ -122,8 +122,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
args = append(args, "--platform", strings.Join(build.Platforms.Value()[:], ","))
}
for _, arg := range build.Tags.Value() {
args = append(args, "-t", fmt.Sprintf("%s:%s", build.Repo, arg))
for _, tag := range build.Tags.Value() {
for _, repo := range build.Repo.Value() {
args = append(args, "-t", fmt.Sprintf("%s:%s", repo, tag))
}
}
for _, l := range build.Labels.Value() {

View File

@ -60,7 +60,7 @@ type Build struct {
Pull bool // Docker build pull
CacheFrom cli.StringSlice // Docker build cache-from
Compress bool // Docker build compress
Repo string // Docker build repository
Repo cli.StringSlice // Docker build repository
NoCache bool // Docker build no-cache
AddHost cli.StringSlice // Docker build add-host
Quiet bool // Docker build quiet