diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 9c63285..0000000 --- a/.drone.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -kind: pipeline -type: kubernetes -name: default - -environment: - GOCACHE: /cache/pkg/cache - GOMODCACHE: /cache/pkg/mod - -steps: - - name: fetch-tags - image: alpine/git - commands: - - git fetch --tags - resources: - requests: - cpu: 250 - memory: 50MiB - limits: - cpu: 250 - memory: 100MiB - - - name: test - image: golang:1.26 - pull: always - volumes: - - name: go - path: /go - - name: gopkg - path: /cache - commands: - - go test -v ./... - - go build ./... - - - name: goreleaser - image: golang:1.26 - pull: always - resources: - requests: - cpu: 6000 - memory: 1024MiB - limits: - cpu: 10000 - memory: 4096MiB - volumes: - - name: go - path: /go - - name: gopkg - path: /cache - environment: - # GITHUB_TOKEN: - # from_secret: GITHUB_TOKEN - commands: - - ./scripts/run-goreleaser - depends_on: [test] - - - name: docker - image: harbor.ntppool.org/ntppool/drone-kaniko:main - pull: always - volumes: - - name: go - path: /go - - name: gopkg - path: /cache - settings: - repo: ntppool/data-api - registry: harbor.ntppool.org - auto_tag: true - tags: SHA7,${DRONE_SOURCE_BRANCH} - cache: true - username: - from_secret: harbor_username - password: - from_secret: harbor_password - depends_on: [goreleaser] - -volumes: - - name: go - temp: {} - - name: gopkg - claim: - name: go-pkg - ---- -kind: signature -hmac: f78b7702ee701ed5d31d772e0423fe4583929d623a98520078fb5aa5a536c0ec - -... diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..bc90fb2 --- /dev/null +++ b/.woodpecker.yaml @@ -0,0 +1,69 @@ +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: test + image: golang:1.26 + pull: true + environment: *go_env + volumes: *go_volumes + commands: + - go test -v ./... + - go build ./... + + - 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] diff --git a/scripts/run-goreleaser b/scripts/run-goreleaser index d5fee4b..eafdeb6 100755 --- a/scripts/run-goreleaser +++ b/scripts/run-goreleaser @@ -2,7 +2,7 @@ set -euo pipefail -go install github.com/goreleaser/goreleaser/v2@v2.12.3 +go install github.com/goreleaser/goreleaser/v2@v2.13.3 if [ ! -z "${harbor_username:-}" ]; then DOCKER_FILE=~/.docker/config.json @@ -13,11 +13,11 @@ if [ ! -z "${harbor_username:-}" ]; then fi fi -DRONE_TAG=${DRONE_TAG-""} +CI_TAG=${CI_COMMIT_TAG:-${DRONE_TAG:-""}} is_snapshot="" -if [ -z "$DRONE_TAG" ]; then +if [ -z "$CI_TAG" ]; then is_snapshot="--snapshot" fi