From 2e41d3d004f450784e7021c5bd039cad3000e21e Mon Sep 17 00:00:00 2001 From: Aaron Riedel Date: Tue, 20 Aug 2024 20:21:17 +0200 Subject: [PATCH] add woodpecker pipeline --- .drone.yml | 124 ------------------------------------ .woodpecker/.build.yaml | 37 +++++++++++ .woodpecker/.deploy.yaml | 26 ++++++++ .woodpecker/.gofmt.yaml | 7 ++ .woodpecker/.lint.yaml | 7 ++ .woodpecker/.vulncheck.yaml | 8 +++ 6 files changed, 85 insertions(+), 124 deletions(-) delete mode 100644 .drone.yml create mode 100644 .woodpecker/.build.yaml create mode 100644 .woodpecker/.deploy.yaml create mode 100644 .woodpecker/.gofmt.yaml create mode 100644 .woodpecker/.lint.yaml create mode 100644 .woodpecker/.vulncheck.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 30aa472..0000000 --- a/.drone.yml +++ /dev/null @@ -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 - diff --git a/.woodpecker/.build.yaml b/.woodpecker/.build.yaml new file mode 100644 index 0000000..27c4fc3 --- /dev/null +++ b/.woodpecker/.build.yaml @@ -0,0 +1,37 @@ +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 + 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 + tags: + - staging + - staging-${CI_PIPELINE_NUMBER} + dry_run: true + when: + - branch: + exclude: main + event: push +depends_on: + - gofmt + - lint + - vulncheck diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml new file mode 100644 index 0000000..952c42c --- /dev/null +++ b/.woodpecker/.deploy.yaml @@ -0,0 +1,26 @@ +steps: +- name: bump tag in deployment-repo + image: git.ar21.de/aaron/kustomize-ci + commands: + - git clone https://git.ar21.de/yolokube/grafana-backuper-deployment.git deployment-repo + - cd deployment-repo/overlay + - 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: 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 ${CI_PIPELINE_NUMBER} (done automagically via Woodpecker pipeline)" + ssh_key: + from_secret: FORGEJO_SSH_KEY + when: + - branch: main + event: push +depends_on: + - build \ No newline at end of file diff --git a/.woodpecker/.gofmt.yaml b/.woodpecker/.gofmt.yaml new file mode 100644 index 0000000..8db41f6 --- /dev/null +++ b/.woodpecker/.gofmt.yaml @@ -0,0 +1,7 @@ +steps: +- name: gofmt + image: golang:1.22.5 + commands: + - gofmt -l -s . + when: + - event: push diff --git a/.woodpecker/.lint.yaml b/.woodpecker/.lint.yaml new file mode 100644 index 0000000..d2477ad --- /dev/null +++ b/.woodpecker/.lint.yaml @@ -0,0 +1,7 @@ +steps: +- name: golangci-linter + image: golangci/golangci-lint:v1.59.1 + commands: + - golangci-lint run ./... + when: + - event: push diff --git a/.woodpecker/.vulncheck.yaml b/.woodpecker/.vulncheck.yaml new file mode 100644 index 0000000..2be22f8 --- /dev/null +++ b/.woodpecker/.vulncheck.yaml @@ -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