softplayer-apps/.woodpecker/.helm-workflow.yml
2024-05-05 18:58:35 +02:00

100 lines
2.8 KiB
YAML

---
when:
event:
- push
.chart-testing-image: &chart-testing-image
image: quay.io/helmpack/chart-testing:v3.10.1
clone:
git:
image: woodpeckerci/plugin-git
settings:
partial: false
steps:
changed:
<<: *chart-testing-image
name: Check changed charts
commands:
- git fetch origin
- helm repo add badhouseplants-lib-testing https://git.badhouseplants.net/api/packages/badhouseplants/helm
- ct lint --target-branch main --print-config --debug
- ct list-changed --target-branch main > .changed
lint:
<<: *chart-testing-image
name: Lint charts
commands:
- git fetch origin
- helm repo add badhouseplants-lib-testing https://git.badhouseplants.net/api/packages/badhouseplants/helm
- |
if [ -s .changed ]; then
ct lint --target-branch main --validate-maintainers=false
fi
test:
<<: *chart-testing-image
name: Test charts
environment:
- DOCKER_HOST=tcp://docker:2375
commands:
- helm repo add badhouseplants-lib-testing https://git.badhouseplants.net/api/packages/badhouseplants/helm
- |
if [ -s .changed ]; then
export PATH=$PWD/.bin:$PATH
apk update && apk add docker curl bash
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d cluster create test --api-port 16443 --k3s-arg="kubelet-args=\"--allowed-unsafe-sysctls=net.ipv4.ip_forward\""@all
sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' ~/.kube/config
kubectl get storageclass
git fetch origin
ct install --target-branch main
ct install --target-branch main --upgrade
fi
release:
<<: *chart-testing-image
name: Release charts
when:
- branch: main
secrets:
- gitea_token
environment:
- DISABLE_FORCE_OVERWRITE='true'
- ALLOW_OVERWRITE='false'
commands:
- |
helm registry login git.badhouseplants.net \
--username allanger \
--password $GITEA_TOKEN
- |
for chart in $(find charts -maxdepth 1 -mindepth 1 -type d); do
helm package $chart -d chart-packages;
done
- |
for chart in $(find chart-packages -maxdepth 1 -mindepth 1 -type f); do
helm push $chart oci://git.badhouseplants.net/softplayer
done
services:
docker:
image: docker:dind
commands:
- echo "1" > /proc/sys/net/ipv4/ip_forward
- dockerd -H tcp://0.0.0.0:2375 --tls=false
privileged: true
ports:
- 2375
- 16443
backend_options:
kubernetes:
resources:
requests:
memory: 500Mi
cpu: 500m
limits:
memory: 1000Mi
cpu: 1000m
securityContext:
privileged: true