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>
This commit is contained in:
6543 2022-10-08 15:32:14 +02:00 committed by anbraten
parent b85ee124e2
commit a7117600aa
3 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
/release/
/vendor/
plugin-docker-buildx

View file

@ -2,9 +2,18 @@ branches: main
variables:
- &platforms 'linux/amd64,linux/arm64'
- &golang 'golang:1.18'
pipeline:
dryrun:
vendor:
image: *golang
commands: go mod vendor
test:
image: *golang
commands: go test -cover ./...
publish-dryrun:
image: woodpeckerci/plugin-docker-buildx:v20.10.18
settings:
platforms: *platforms

View file

@ -130,7 +130,7 @@ func (p *Plugin) writeBuildkitConfig() error {
caPath := fmt.Sprintf("/etc/docker/certs.d/%s/ca.crt", registry)
ca, err := os.Open(caPath)
if err != nil && !os.IsNotExist(err) {
logrus.Warnf("error reading %s: %w", caPath, err)
logrus.Warnf("error reading %s: %v", caPath, err)
} else if err == nil {
ca.Close()
p.settings.Daemon.BuildkitConfig = fmt.Sprintf(buildkitConfigTemplate, registry, caPath)