build(ci): migrate from Drone to Woodpecker
Some checks failed
ci/woodpecker/tag/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/tag/woodpecker Pipeline failed
Replace .drone.yml with .woodpecker.yaml and update scripts/run-goreleaser to use CI_COMMIT_TAG instead of DRONE_TAG.
This commit is contained in:
88
.drone.yml
88
.drone.yml
@@ -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
|
|
||||||
|
|
||||||
...
|
|
||||||
69
.woodpecker.yaml
Normal file
69
.woodpecker.yaml
Normal file
@@ -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]
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
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
|
if [ ! -z "${harbor_username:-}" ]; then
|
||||||
DOCKER_FILE=~/.docker/config.json
|
DOCKER_FILE=~/.docker/config.json
|
||||||
@@ -13,11 +13,11 @@ if [ ! -z "${harbor_username:-}" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DRONE_TAG=${DRONE_TAG-""}
|
CI_TAG=${CI_COMMIT_TAG:-${DRONE_TAG:-""}}
|
||||||
|
|
||||||
is_snapshot=""
|
is_snapshot=""
|
||||||
|
|
||||||
if [ -z "$DRONE_TAG" ]; then
|
if [ -z "$CI_TAG" ]; then
|
||||||
is_snapshot="--snapshot"
|
is_snapshot="--snapshot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user