102 lines
2.9 KiB
YAML
102 lines
2.9 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
|
|
./scripts/lint.sh
|
|
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
|
|
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
|
|
./scripts/test.sh
|
|
fi
|
|
|
|
release:
|
|
<<: *chart-testing-image
|
|
name: Release charts
|
|
when:
|
|
- branch: main
|
|
secrets:
|
|
- registry_password
|
|
environment:
|
|
- DISABLE_FORCE_OVERWRITE='true'
|
|
- ALLOW_OVERWRITE='false'
|
|
- REGISTRY_URL="registry.badhouseplants.net"
|
|
- REGISTRY_USERNAME="woody"
|
|
commands:
|
|
- |
|
|
helm registry login $REGISTRY_URL \
|
|
--username $REGISTRY_USERNAME \
|
|
--password $REGISTRY_PASSWORD
|
|
- |
|
|
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://registry.badhouseplants.net/softplayer/helm
|
|
done
|
|
|
|
services:
|
|
docker:
|
|
image: docker:dind
|
|
commands:
|
|
- echo "1" > /proc/sys/net/ipv4/ip_forward
|
|
- echo "nameserver 8.8.8.8" > /etc/resolv.conf
|
|
- 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
|