softplayer-apps/.woodpecker/.helm-workflow.yml

103 lines
2.9 KiB
YAML
Raw Normal View History

2024-05-05 16:58:35 +00:00
---
when:
event:
- push
.chart-testing-image: &chart-testing-image
2024-07-14 09:42:02 +00:00
image: quay.io/helmpack/chart-testing:v3.11.0
2024-05-05 16:58:35 +00:00
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
2024-05-19 20:49:21 +00:00
./scripts/lint.sh
2024-05-05 16:58:35 +00:00
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
echo "nameserver 8.8.8.8" > /etc/resolv.conf
2024-05-05 16:58:35 +00:00
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
git fetch origin
2024-05-19 20:49:21 +00:00
./scripts/test.sh
2024-05-05 16:58:35 +00:00
fi
release:
2024-07-14 09:46:57 +00:00
image: alpine/helm:3.15.3
2024-05-05 16:58:35 +00:00
name: Release charts
when:
- branch: main
secrets:
2024-07-14 09:20:12 +00:00
- registry_password
2024-05-05 16:58:35 +00:00
environment:
- DISABLE_FORCE_OVERWRITE='true'
- ALLOW_OVERWRITE='false'
2024-07-14 09:54:38 +00:00
- REGISTRY_URL=registry.badhouseplants.net
- REGISTRY_USERNAME=woody
2024-05-05 16:58:35 +00:00
commands:
- |
2024-07-14 09:20:12 +00:00
helm registry login $REGISTRY_URL \
--username $REGISTRY_USERNAME \
--password $REGISTRY_PASSWORD
2024-05-05 16:58:35 +00:00
- |
for chart in $(find charts -maxdepth 1 -mindepth 1 -type d); do
2024-07-15 17:53:19 +00:00
helm dependency update $chart
2024-05-05 16:58:35 +00:00
helm package $chart -d chart-packages;
done
- |
for chart in $(find chart-packages -maxdepth 1 -mindepth 1 -type f); do
2024-07-14 09:42:02 +00:00
helm push $chart oci://$REGISTRY_URL/softplayer/helm
2024-05-05 16:58:35 +00:00
done
services:
docker:
image: docker:dind
commands:
- echo "1" > /proc/sys/net/ipv4/ip_forward
- echo "nameserver 8.8.8.8" > /etc/resolv.conf
2024-05-05 16:58:35 +00:00
- 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