Add a workflow

This commit is contained in:
Nikolai Rodionov 2024-01-02 15:58:42 +01:00
commit 09fbf14d14
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
1 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,91 @@
---
.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
- 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
- |
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:
- |
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 plugin install https://github.com/chartmuseum/helm-push
- |
helm repo add --username allanger --password $GITEA_TOKEN \
allanger-charts https://git.badhouseplants.net/api/packages/allanger/helm
- |
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 cm-push $chart allanger-charts
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