Add a vendor step that uses gitea_token to fetch private modules from gitea.develooper.com, then subsequent steps use the vendored dependencies without needing credentials.
84 lines
1.7 KiB
YAML
84 lines
1.7 KiB
YAML
when:
|
|
- event: [push, pull_request, tag, manual]
|
|
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git
|
|
settings:
|
|
tags: true
|
|
|
|
variables:
|
|
- &go_env
|
|
GOMODCACHE: /go/pkg/mod
|
|
GOCACHE: /go/pkg/cache
|
|
- &go_volumes
|
|
- go-pkg:/go/pkg
|
|
|
|
steps:
|
|
- name: vendor
|
|
image: golang:1.26
|
|
pull: true
|
|
environment:
|
|
GOMODCACHE: /go/pkg/mod
|
|
GOCACHE: /go/pkg/cache
|
|
volumes: *go_volumes
|
|
secrets: [gitea_token]
|
|
commands:
|
|
- printf "machine gitea.develooper.com\nlogin __token__\npassword $GITEA_TOKEN\n" > ~/.netrc
|
|
- go mod vendor
|
|
- rm -f ~/.netrc
|
|
|
|
- name: test
|
|
image: golang:1.26
|
|
pull: true
|
|
environment: *go_env
|
|
volumes: *go_volumes
|
|
commands:
|
|
- go test -v ./...
|
|
- go build ./...
|
|
depends_on: [vendor]
|
|
|
|
- name: goreleaser
|
|
image: golang:1.26
|
|
pull: true
|
|
environment: *go_env
|
|
volumes: *go_volumes
|
|
commands:
|
|
- ./scripts/run-goreleaser
|
|
backend_options:
|
|
kubernetes:
|
|
resources:
|
|
requests:
|
|
cpu: 6000
|
|
memory: 1024Mi
|
|
limits:
|
|
cpu: 10000
|
|
memory: 4096Mi
|
|
depends_on: [test]
|
|
|
|
- name: generate-tags
|
|
image: ghcr.io/abh/woodpecker-docker-tags-plugin:sha-8a3bd7c
|
|
settings:
|
|
tags: |
|
|
branch
|
|
sha
|
|
semver --auto
|
|
edge -v latest
|
|
when:
|
|
- event: [push, tag, manual]
|
|
depends_on: [goreleaser]
|
|
|
|
- name: docker
|
|
image: woodpeckerci/plugin-kaniko
|
|
settings:
|
|
registry: harbor.ntppool.org
|
|
repo: ntppool/data-api
|
|
cache: true
|
|
username:
|
|
from_secret: harbor_username
|
|
password:
|
|
from_secret: harbor_password
|
|
when:
|
|
- event: [push, tag, manual]
|
|
depends_on: [goreleaser, generate-tags]
|