add woodpecker pipeline

This commit is contained in:
Aaron Riedel 2024-08-20 20:21:17 +02:00 committed by Tom Neuber
parent 64a96bc8e2
commit 316e5de757
Signed by: tom
GPG key ID: F17EFE4272D89FF6
6 changed files with 122 additions and 124 deletions

View file

@ -1,124 +0,0 @@
kind: pipeline
name: build
steps:
- name: gofmt
image: golang:1.22.5
commands:
- gofmt -l -s .
when:
event:
- push
- name: golangci-linter
image: golangci/golangci-lint:v1.59.1
commands:
- golangci-lint run ./...
when:
event:
- push
- name: vuln-check
image: golang:1.22.5
commands:
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
when:
event:
- push
- name: docker
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
registry: git.ar21.de
username:
from_secret: REGISTRY_USER
password:
from_secret: REGISTRY_PASS
repo: git.ar21.de/yolokube/grafana-backuper
tags:
- latest
- ${DRONE_BUILD_NUMBER}
platforms:
- linux/arm64
- linux/amd64
when:
branch:
- main
event:
- push
depends_on:
- gofmt
- golangci-linter
- vuln-check
- name: docker-build
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
registry: git.ar21.de
username:
from_secret: REGISTRY_USER
password:
from_secret: REGISTRY_PASS
repo: git.ar21.de/yolokube/grafana-backuper
tags:
- latest
- ${DRONE_BUILD_NUMBER}
platforms:
- linux/arm64
- linux/amd64
dry_run: true
when:
branch:
exclude:
- main
event:
- push
depends_on:
- gofmt
- golangci-linter
- vuln-check
- name: bump tag in deployment-repo
image: git.ar21.de/aaron/kustomize-ci
commands:
- cd /deployment-repo
- git clone https://git.ar21.de/yolokube/grafana-backuper-deployment.git .
- cd /deployment-repo/overlay
- kustomize edit set image git.ar21.de/yolokube/grafana-backuper=git.ar21.de/yolokube/grafana-backuper:${DRONE_BUILD_NUMBER}
volumes:
- name: deployment-repo
path: /deployment-repo
when:
branch:
- main
event:
- push
depends_on:
- docker
- name: push new tag to deployment-repo
image: appleboy/drone-git-push
settings:
branch: main
remote: ssh://git@git.ar21.de:2222/yolokube/grafana-backuper-deployment.git
path: /deployment-repo
force: false
commit: true
commit_message: "GRAFANA-BACKUPER: update image tag to ${DRONE_BUILD_NUMBER} (done automagically via Drone pipeline)"
ssh_key:
from_secret: GITEA_SSH_KEY
volumes:
- name: deployment-repo
path: /deployment-repo
when:
branch:
- main
event:
- push
depends_on:
- bump tag in deployment-repo
volumes:
- name: deployment-repo
temp: {}
when:
event:
exclude:
- pull_request

43
.woodpecker/.build.yaml Normal file
View file

@ -0,0 +1,43 @@
steps:
- name: docker
image: woodpeckerci/plugin-docker-buildx
settings:
registry: git.ar21.de
username:
from_secret: REGISTRY_USER
password:
from_secret: REGISTRY_PASS
repo: git.ar21.de/yolokube/grafana-backuper
platforms:
- linux/amd64
- linux/arm64
tags:
- latest
- ${CI_PIPELINE_NUMBER}
when:
- branch: main
event: push
- name: docker-staging
image: woodpeckerci/plugin-docker-buildx
settings:
registry: git.ar21.de
username:
from_secret: REGISTRY_USER
password:
from_secret: REGISTRY_PASS
repo: git.ar21.de/yolokube/grafana-backuper
platforms:
- linux/amd64
- linux/arm64
tags:
- staging
- staging-${CI_PIPELINE_NUMBER}
dry_run: true
when:
- branch:
exclude: main
event: push
depends_on:
- gofmt
- lint
- vulncheck

57
.woodpecker/.deploy.yaml Normal file
View file

@ -0,0 +1,57 @@
skip_clone: true
steps:
- name: bump tag in deployment-repo
image: git.ar21.de/aaron/kustomize-ci
commands:
- git clone https://git.ar21.de/yolokube/core-deployments.git deployment-repo
- cd deployment-repo/grafana-backuper
- kustomize edit set image git.ar21.de/yolokube/grafana-backuper=git.ar21.de/yolokube/grafana-backuper:${CI_PIPELINE_NUMBER}
when:
- branch: main
event: push
- name: push new tag to deployment-repo
image: appleboy/drone-git-push
settings:
branch: "${CI_PIPELINE_NUMBER}_grafana_backuper"
remote: ssh://git@git.ar21.de:2222/yolokube/core-deployments.git
path: deployment-repo
force: false
commit: true
commit_message: "GRAFANA BACKUPER: update image tag to ${CI_PIPELINE_NUMBER} (done automagically via Woodpecker pipeline)"
ssh_key:
from_secret: FORGEJO_SSH_KEY
when:
- branch: main
event: push
- name: create pull request
image: git.ar21.de/tom/push-message-randomizer:latest
pull: true
settings:
gitea_address: https://git.ar21.de
gitea_token:
from_secret: FORGEJO_API
owner: ${CI_REPO_OWNER}
repo: core-deployments
branch: "${CI_PIPELINE_NUMBER}_grafana_backuper"
base_branch: main
pr_title: "GRAFANA BACKUPER: update image tag to ${CI_PIPELINE_NUMBER}"
pr_body: |
### Grafana-Backuper image update
{- random-pr-message -}
### Configuration
📅 **Schedule**: Branch creation - At any time, Automerge - At any time.
🚦 **Automerge**: Enabled.
skip_on_missing_branch: true
close_pr_if_empty: true
delete_branch_if_pr_empty: true
merge_when_checks_succeed: true
delete_branch_after_merge: true
when:
- branch: main
event: push
depends_on:
- build

7
.woodpecker/.gofmt.yaml Normal file
View file

@ -0,0 +1,7 @@
steps:
- name: gofmt
image: golang:1.22.5
commands:
- gofmt -l -s .
when:
- event: push

7
.woodpecker/.lint.yaml Normal file
View file

@ -0,0 +1,7 @@
steps:
- name: golangci-linter
image: golangci/golangci-lint:v1.59.1
commands:
- golangci-lint run ./...
when:
- event: push

View file

@ -0,0 +1,8 @@
steps:
- name: vuln-check
image: golang:1.22.5
commands:
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
when:
- event: push