container-openvpn/.drone.yml
2023-12-14 20:12:21 +01:00

133 lines
3.5 KiB
YAML

---
kind: pipeline
type: docker
name: Lint the chart
trigger:
event:
- push
environment:
KIND_VERSION: v0.20.0
HELM_VERSION: v3.12.1
KUBECTL_VERSION: v1.28.3
CT_VERSION: 3.10.1
steps:
# ---------------------------------------------------------------------
# -- Prepare dependencies
# ---------------------------------------------------------------------
- name: Download dependencies
image: ghcr.io/allanger/dumb-downloader:latest
commands:
- mkdir .bin
# -- Download kind
- dudo -l "https://kind.sigs.k8s.io/dl/{{ version }}/kind-{{ os }}-{{ arch }}" -d .bin/kind -p $KIND_VERSION
- chmod +x .bin/kind
- name: Check changed charts
image: quay.io/helmpack/chart-testing
volumes:
- name: dockersock
path: /var/run
commands:
- export KUBECONFIG=$PWD/kubeconfig
- git fetch origin
- |
if [[ -n "$(ct list-changed --chart-dirs . --target-branch main)" ]]; then
touch .changed
fi
- name: Lint changed charts
image: quay.io/helmpack/chart-testing
volumes:
- name: dockersock
path: /var/run
commands:
- git fetch origin
- |
if [ -e .changed ]; then
ct lint --target-branch main --validate-maintainers=false --chart-dirs .
fi
- name: Test changed charts
image: quay.io/helmpack/chart-testing
volumes:
- name: dockersock
path: /var/run
commands:
- export PATH=$PWD/.bin:$PATH
- apk update && apk add docker
- kind create cluster --config kind.yaml
- sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' ~/.kube/config
- kubectl get storageclass
- git fetch origin
- |
if [ -e .changed ]; then
ct install --target-branch main --chart-dirs .
ct install --target-branch main --chart-dirs . --upgrade
fi
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
---
# ----------------------------------------------
# -- Build an image and push it to the registry
# ----------------------------------------------
kind: pipeline
type: docker
name: Build the builder
trigger:
event:
- push
branch:
- main
steps:
- name: Build openvpn xor amd64
image: git.badhouseplants.net/badhouseplants/badhouseplants-builder:555262114ea81f6f286010474527f419b56d33a3
privileged: true
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
CONTAINERFILE: ./containerfiles/Containerfile-XOR
CUSTOM_TAG: v2.6.5-XOR-4.0.0beta08
commands:
- build-container
- name: Build openvpn amd64
image: git.badhouseplants.net/badhouseplants/badhouseplants-builder:555262114ea81f6f286010474527f419b56d33a3
privileged: true
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
CONTAINERFILE: ./containerfiles/Containerfile
CUSTOM_TAG: v2.6.8
commands:
- build-container
- name: Publish the Helm chart
image: alpine/helm
depends_on:
- Build openvpn xor amd64
- Build openvpn amd64
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
commands:
- cd helm
- helm plugin install https://github.com/chartmuseum/helm-push
- helm package . -d chart-package
- helm repo add --username allanger --password $GITEA_TOKEN openvpn https://git.badhouseplants.net/api/packages/allanger/helm
- helm cm-push "./chart-package/$(ls chart-package)" openvpn