Commit graph

40 commits

Author SHA1 Message Date
David Kovari ef56bac838 Improve support for cache_to and cache_from & add cache_images (#129)
### 📖 Summary

Originally, the cache_to and cache_from were being converted into string arrays. Then their contents were looped over to add to the build command. This has the side affect of stopping the user from setting additional options for the cache-to and cache-from args since their command input format uses commas. i.e. `type=registry,ref=imagepath,mode=max` would result in `--cache-to type=registry --cache-to ref=imagepath --cache-to mode=max`. The command was not designed to be used that way.

The one reason I can think of for cache_to and cache_from to be arrays is so you could have multiple cache registries. But I can't confirm that the build command even works like this.

### 📑 Build PR Images?

PR images are not needed

### 💬 Details

_No response_

Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/129
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: David Kovari <dakovari@gmail.com>
Co-committed-by: David Kovari <dakovari@gmail.com>
2024-02-02 20:25:30 +00:00
6543 5d98a5da22 Add option to set individual mirrors for all logins (#122)
- also address last nits of #119

Co-authored-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/122
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
2024-01-18 18:28:42 +00:00
6543 fef922e92a format via gofumpt (#123)
format code ;)

Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/123
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2024-01-15 07:06:52 +00:00
David Kovari 55cc3b1d21 Add option to enable buildkit debug output (#119)
### 📖 Summary

- Add option to enable buildkit debug output
- Formats buildkit.toml using `github.com/pelletier/go-toml/v2`
- Sets docker.io registry mirror based on daemon.mirror setting

Co-authored-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/119
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: David Kovari <dakovari@gmail.com>
Co-committed-by: David Kovari <dakovari@gmail.com>
2024-01-14 23:35:00 +00:00
pat-s 5f5b2d4161 Document ECR settings and prefix settings with ecr_ (#115)
Prefixing to make the settings easier to distinguish from non-ECR ones.

Also expanded the multi-repo push example.

Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/115
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2023-12-30 13:50:43 +00:00
pat-s e93554e4bc feat: add support for AWS ECR (#110)
fix #74

Mainly borrowed from https://github.com/drone-plugins/drone-docker/tree/master/cmd/drone-ecr.

`drone/ecr` is still on 20.10.14 and sparsely updated/maintained. Would be great to add support for additional registries like ECR to buildx.
The login process is as follows:

1. Call the AWS API with some arguments to get a short-lived auth token (12h)
2. Use the token and Username `AWS` for the `docker login` call

## Notes

- To push to ECR, the full registry URL must be given in the tag, i.e. `registry/owner/repo`. For this, `Registry` must also be added the to `Build` struct besides the `Settings` struct
- For now I've only referenced the source in `ecr.go` by using the most recent commit of today. Should this be done differently?
- The implementation here from me is simple and probably a bit "naive" as this is my first "real" golang feature PR.
- I've tested this change with a custom image and was able to successfully push to ECR while dynamically creating a repository. Proper tests would still be great...
- Vars `assumeRole` and `externalID` are somehow not exposed in https://plugins.drone.io/plugins/ecr and I am not sure if this is by design or because they were just forgotten. Anyhow, this is reason I didn't expose them for now and just added internal dummy vars.
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2023-12-29 22:06:37 +00:00
OCram85 a0371f8850 adds driver-opt arg as plugin parameter (#93)
#### 📖 Summary

Adds `--driver-opt` buildx arg as plugin parameter. This should make it possible to pass through proxy settings.

#### 📑 Test Plan

> 💡 Select your test plan for the code changes.

-  [x] CI pipeline tests
- Custom test
-  No test plan

##### Details / Justification

Manually tested on own instance behind corporate proxy:

![image](/attachments/b65d981d-c9b8-4228-8e9c-61fa517d98b6)

Unfortunately  the `--build-arg` passthru seems not working

#### 📚 Additional Notes

- fixes #82
- still to do:
  - [x] update docs
  - [x] add usage example

> 💡NOTE: This is my first contribution in this codebase. Feedback and help is probably needed 😸

Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/93
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: OCram85 <marco.blessing@googlemail.com>
Co-committed-by: OCram85 <marco.blessing@googlemail.com>
2023-10-25 09:58:02 +00:00
6543 37718ded77 Add option to overwrites tags option with values specified in an file (#62)
Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/62
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2023-05-02 19:25:49 +00:00
6543 ccd5834d4c Enhance SemVersion detection (#52)
close #51

Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/52
Reviewed-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2022-12-21 17:11:09 +00:00
Lauris BH 186b87cf88 Fix auto tag generating tags with wrong suffix (#48)
currently `auto_tag` would generate tags like: `1-latest`, `1.0-latest` etc

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/48
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
2022-12-09 10:53:49 +00:00
miniduikboot a187589df9 add cache_to option and remove manual image pull (#46)
Port from https://github.com/thegeeklab/drone-docker-buildx/pull/124

Basically docker cache got a bit fancier and now includes a cache manifest. Manually pulling these containers isn't sufficient enough, so remove the manual pull.

cache_to allows you to push your cache including a manifest to a remote location: https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to

Unfortunately this option isn't quite that useful: to fully use this feature, you need to supply your arguments in CSV format, which woodpecker unhelpfully splits into multiple completely separate arguments, breaking it :(

With a further change to fix that issue I managed to turn a multistage rust build from ~3 minutes down to 20 seconds.

Co-authored-by: miniduikboot <mini@duikbo.at>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/46
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: miniduikboot <miniduikboot@noreply.codeberg.org>
Co-committed-by: miniduikboot <miniduikboot@noreply.codeberg.org>
2022-11-23 15:55:12 +00:00
Lauris BH a2d26878e7 Add internal DNS server if no custom DNS is set (#45)
Fixes #44

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/45
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-11-23 14:01:45 +00:00
6543 d17ff57fda Document auto_tag behaviour more explicite (#37)
close #31

Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/37
Reviewed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-11-06 14:29:57 +01:00
gapodo fce3289743 Add configurable tag for use with auto_tag (#36)
Implements #30, allows setting a (single) tag to override the default of `latest` allows for the woodpecker-ci usecase of setting `next` as the tag for the default branch.

Co-authored-by: Gapodo <gapodo@datenclown.at>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/36
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: gapodo <gapodo@geekvoid.net>
Co-committed-by: gapodo <gapodo@geekvoid.net>
2022-11-05 03:25:44 +01:00
gapodo f10f7b4c7f Allow using auto_tag while supplying additional tags via tags (#35)
This implements #32, allowing to append tags supplied via `tags` along side auto generated tags.

Tags supplied via `tags` are *not* suffixed by the `auto_tag_suffix`

Co-authored-by: Gapodo <gapodo@datenclown.at>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/35
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: gapodo <gapodo@geekvoid.net>
Co-committed-by: gapodo <gapodo@geekvoid.net>
2022-11-04 23:47:43 +01:00
6543 fca44ab7ae Fix func to determine default login (#29)
only add default login if auth profided or no login entry exist

Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/29
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-10-11 11:38:36 +02:00
6543 25ad50a579 Add support for multible registrys (#23)
if normal settings `registry`, `username`... is set

that's used as default, else first logins entry is used.

```yml
settings:
  logins:
    - registry: https://codeberg.org
      username: "6543"
      password: geheim
    - registry: https://index.docker.io/v1/
      username: a6543
      password: anders_geheim
```

close #18

Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/23
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
2022-10-08 16:02:02 +02:00
6543 a7117600aa CI: add test (#26)
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/26
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2022-10-08 15:32:14 +02:00
6543 10426e6a19 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
2022-09-28 15:17:39 +02:00
6543 06d32b13a5
ingore empty string tags 2022-09-28 03:25:04 +02:00
6543 ddf80c66d6 clean & refactor (#20)
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/20
2022-09-28 02:22:04 +02:00
Lauris BH be7d7c0244 Implement option to add image labels and generate automatic labels (#19)
Fixes #16

Results into labels:
![attels](/attachments/3aa6641e-fe50-4e28-be97-64c0afe2c35a)

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/19
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-09-28 02:16:57 +02:00
Lauris BH 8a0424c7a5 Automatically generate buildkit config with registry CA file (#17)
Fixes #14

Buildkit config is actually TOML file not JSON - https://docs.docker.com/engine/reference/commandline/buildx_create/#config

Tested using `lafriks/plugin-docker-buildx:latest` image built with these changes

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/17
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-09-27 22:33:05 +02:00
Lauris BH b88f39c31f Add build output option (#11)
Fixes #6

Also updates dependencies

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/11
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-09-20 18:02:35 +02:00
Robert Kaussow 276f215b24
fix: remove unimplemented squash option (#52) 2021-09-07 21:34:47 +02:00
Robert Kaussow a5a561fd91
feat: load buildkit config from string instead of file (#37) 2021-07-25 14:28:33 +02:00
Albie 904641bf10
feat: add option to specify buildkit config file path (#32) 2021-07-08 09:00:51 +02:00
Robert Kaussow 29f1707797
cleanup unused code 2021-07-03 15:09:12 +02:00
Maarten De Wispelaere 2e0e0dd7d7
Possible fix for https://github.com/thegeeklab/drone-docker-buildx/issues/28 (#30) 2021-07-02 18:58:55 +02:00
Robert Kaussow a6cc96fbda
fix: allow multi-platform builds using --push flag (#29) 2021-06-16 22:21:00 +02:00
Robert Kaussow 410d80eb98
append users build-args to the default slice 2021-01-22 12:57:32 +01:00
Robert Kaussow 95cc0cafe5
fix string formatting 2021-01-22 12:19:34 +01:00
Robert Kaussow 3bb91263e1
feat: set DOCKER_IMAGE_CREATED as build-arg 2021-01-22 12:00:14 +01:00
Robert Kaussow 90f4d344e8
Revert "feat: add env variable DRONE_DOCKER_BUILD_TIME to docker cmd"
This reverts commit 0e25852747.
2021-01-22 11:57:01 +01:00
Robert Kaussow 0e25852747
feat: add env variable DRONE_DOCKER_BUILD_TIME to docker cmd 2021-01-22 11:17:55 +01:00
Robert Kaussow 671755636d
revert seccomp patch 2021-01-16 22:11:08 +01:00
Robert Kaussow 3a1c3f61cd
patch seccomp profile 2021-01-16 21:56:43 +01:00
Robert Kaussow 41a9f02b92
fix redefined flags 2021-01-11 22:38:17 +01:00
Robert Kaussow 2496502ff6
fix staticcheck 2021-01-11 22:06:24 +01:00
Robert Kaussow ba28c39a7d
refactor: update dependencies and use plugin boilerplate 2021-01-11 21:54:49 +01:00