feat: migrate from drone to woodpecker (#67)
ci/woodpecker/push/test Pipeline was successful Details

Reviewed-on: #67
This commit is contained in:
Dawid Wysokiński 2023-09-09 05:03:30 +00:00
parent 900c173702
commit 4e54a84ff5
5 changed files with 84 additions and 168 deletions

View File

@ -1,167 +0,0 @@
---
kind: pipeline
type: docker
name: build
platform:
os: linux
arch: amd64
steps:
- name: build
image: node:16-bullseye
commands:
- yarn && yarn build
trigger:
event:
- push
- pull_request
branch:
- master
---
kind: pipeline
type: docker
name: linux-amd64
platform:
os: linux
arch: amd64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
registry: gitea.dwysokinski.me
repo: gitea.dwysokinski.me/twhelp-packages/scripts
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: Dockerfile
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from
from.name: Drone
host:
from_secret: email_host
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
- notifications@dwysokinski.me
recipients_only: true
when:
status:
- failure
trigger:
event:
- tag
---
kind: pipeline
type: docker
name: manifest
steps:
- name: manifest
image: plugins/manifest
settings:
auto_tag: "true"
ignore_missing: "true"
spec: manifest.tmpl
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: manifest-latest
image: plugins/manifest
settings:
tags: latest
ignore_missing: "true"
spec: manifest.tmpl
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from
from.name: Drone
host:
from_secret: email_host
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
- notifications@dwysokinski.me
recipients_only: true
when:
status:
- failure
trigger:
event:
- tag
depends_on:
- linux-amd64
---
kind: pipeline
type: docker
name: deploy
steps:
- name: deploy-k8s
image: alpine/k8s:1.26.5
environment:
KUBECONFIG:
from_secret: kubeconfig
commands:
- "mkdir ~/.kube && echo \"$KUBECONFIG\" > ~/.kube/twhelp"
- "cd ./k8s/overlays/prod && kustomize edit set image scripts=gitea.dwysokinski.me/twhelp-packages/scripts:${DRONE_TAG##v} && cd ../../.."
- kustomize build ./k8s/overlays/prod | kubectl --kubeconfig ~/.kube/twhelp apply -n twhelp -f -
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from
from.name: Drone
host:
from_secret: email_host
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
- notifications@dwysokinski.me
recipients_only: true
subject: "[deploy - {{ build.status }}] {{ repo.owner }}/{{ repo.name }} ({{ build.branch }} - {{ truncate build.commit 8 }})"
when:
status:
- success
- failure
trigger:
event:
- tag
depends_on:
- manifest
---
kind: signature
hmac: 7d871aa28a97b39f7c567f55700bffcb2919a8b7caf9e232bf99b6a045b15369
...

34
.woodpecker/deploy.yml Normal file
View File

@ -0,0 +1,34 @@
when:
event: [tag]
ref: refs/tags/v*
steps:
deploy:
image: alpine/k8s:1.26.5
secrets:
- kubeconfig
commands:
- "mkdir ~/.kube && echo \"$KUBECONFIG\" > ~/.kube/twhelp"
- "cd ./k8s/overlays/prod && kustomize edit set image scripts=gitea.dwysokinski.me/twhelp-packages/scripts:${CI_COMMIT_TAG##v} && cd ../../.."
- kustomize build ./k8s/overlays/prod | kubectl --kubeconfig ~/.kube/twhelp apply -n twhelp -f -
notify:
image: deblan/woodpecker-email
settings:
from:
from_secret: email_from
from.name: Woodpecker
host:
from_secret: email_host
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
- notifications@dwysokinski.me
recipients_only: true
subject: "[deploy - {{ build.status }}] {{ repo.owner }}/{{ repo.name }} ({{ build.branch }} - {{ truncate build.commit 8 }})"
when:
status: [failure]
depends_on:
- docker

34
.woodpecker/docker.yml Normal file
View File

@ -0,0 +1,34 @@
when:
event: [tag]
ref: refs/tags/v*
steps:
publish:
image: woodpeckerci/plugin-docker-buildx
group: docker
settings:
platforms: linux/amd64
repo: gitea.dwysokinski.me/twhelp-packages/scripts
registry: gitea.dwysokinski.me
auto_tag: true
username:
from_secret: docker_username
password:
from_secret: docker_password
notify:
image: deblan/woodpecker-email
settings:
from:
from_secret: email_from
from.name: Woodpecker
host:
from_secret: email_host
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
- notifications@dwysokinski.me
recipients_only: true
when:
status: [failure]

15
.woodpecker/test.yml Normal file
View File

@ -0,0 +1,15 @@
when:
- event: [pull_request]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
variables:
- &node_image 'node:18'
steps:
test-build:
image: *node_image
pull: true
commands:
- yarn && yarn build

View File

@ -1,4 +1,4 @@
FROM node:16.20-alpine as build-deps
FROM node:18.17-alpine as build-deps
WORKDIR /app
COPY package.json yarn.lock ./