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/ /release/
/vendor/
plugin-docker-buildx plugin-docker-buildx

View File

@ -2,9 +2,18 @@ branches: main
variables: variables:
- &platforms 'linux/amd64,linux/arm64' - &platforms 'linux/amd64,linux/arm64'
- &golang 'golang:1.18'
pipeline: 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 image: woodpeckerci/plugin-docker-buildx:v20.10.18
settings: settings:
platforms: *platforms platforms: *platforms

View File

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