ci: use k3s instead of kind (#773)

Reviewed-on: https://code.forgejo.org/forgejo-helm/forgejo-helm/pulls/773
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Michael Kriese 2024-08-16 12:58:57 +00:00 committed by Michael Kriese
parent 0b5034b40f
commit 0161036601
3 changed files with 49 additions and 26 deletions

View file

@ -0,0 +1,25 @@
# action.yml
name: setup-k3s
description: 'setup k3s'
inputs:
version:
description: 'k3s version'
required: true
runs:
using: 'composite'
steps:
- shell: bash
name: install k3s
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${INPUT_VERSION} K3S_KUBECONFIG_MODE=640 sh -s - server
echo "KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> $GITHUB_ENV
- shell: bash
name: check k3s
run: kubectl cluster-info
- shell: bash
name: wait for nodes ready
run: |
sleep 3
kubectl wait --for=condition=Ready nodes --all --timeout=600s

View file

@ -16,7 +16,6 @@ env:
HELM_VERSION: v3.15.4 # renovate: datasource=github-releases depName=helm packageName=helm/helm
HELM_UNITTEST_VERSION: v0.5.2 # renovate: datasource=github-releases depName=helm-unittest packageName=helm-unittest/helm-unittest
HELM_CHART_TESTING_VERSION: v3.11.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing
KIND_VERSION: v0.24.0 # renovate: datasource=github-releases depName=kind packageName=kubernetes-sigs/kind
KUBECTL_VERSION: v1.31.0 # renovate: datasource=github-releases depName=kubectl packageName=kubernetes/kubernetes
jobs:
@ -74,16 +73,18 @@ jobs:
- run: ct lint --config tools/ct.yml --charts .
e2e:
needs:
- lint-node
- lint-helm
runs-on: k8s
strategy:
matrix:
k8s:
# from https://hub.docker.com/r/kindest/node/tags
- v1.27.16 # renovate: kindest
- v1.28.13 # renovate: kindest
- v1.29.8 # renovate: kindest
- v1.30.4 # renovate: kindest
k3s:
- v1.27.16+k3s1 # renovate: k3s
- v1.28.12+k3s1 # renovate: k3s
- v1.29.7+k3s1 # renovate: k3s
- v1.30.3+k3s1 # renovate: k3s
steps:
- run: cat /etc/os-release
@ -107,14 +108,9 @@ jobs:
with:
version: ${{ env.HELM_CHART_TESTING_VERSION }}
- uses: ./.forgejo/actions/setup-docker
- name: Create kind cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
- uses: ./.forgejo/actions/setup-k3s
with:
node_image: kindest/node:${{ matrix.k8s }}
kubectl_version: ${{ env.KUBECTL_VERSION }}
version: ${{ env.KIND_VERSION }}
version: ${{ matrix.k3s }}
- run: kubectl get no -o wide

View file

@ -1,6 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["forgejo-contrib/forgejo-renovate//base.json"],
"extends": [
"forgejo-contrib/forgejo-renovate//base.json",
"github>visualon/renovate-config//k3s.json"
],
"assignees": ["viceice"],
"baseBranches": ["main", "/^maint\\/.+/"],
"packageRules": [
@ -67,13 +70,13 @@
"automerge": true
},
{
"description": "Separate minor and patch updates for kindest",
"matchPackageNames": ["kindest/node"],
"description": "Separate minor and patch updates for k3s",
"matchPackageNames": ["k3s-io/k3s"],
"separateMinorPatch": true
},
{
"description": "Require approval and no automerge for kindest major and minor updates",
"matchPackageNames": ["kindest/node"],
"description": "Require approval and no automerge for k3s major and minor updates",
"matchPackageNames": ["k3s-io/k3s"],
"matchUpdateTypes": ["major", "minor"],
"dependencyDashboardApproval": true,
"automerge": false
@ -122,16 +125,15 @@
},
{
"customType": "regex",
"description": "Update kindest kubernetes references",
"description": "Update k3s kubernetes references",
"fileMatch": ["^\\.forgejo/workflows/[^/]+\\.ya?ml$"],
"matchStrings": [
" +- (?<currentValue>v\\d+\\.\\d+\\.\\d+) # renovate: kindest\\n"
],
"depNameTemplate": "kindest/node",
"datasourceTemplate": "docker"
"matchStrings": [" +- (?<currentValue>.+?) # renovate: k3s\\n"],
"depNameTemplate": "k3s",
"packageNameTemplate": "k3s-io/k3s",
"datasourceTemplate": "github-releases"
}
],
"helm-values": {
"fileMatch": ["^ci/.+\\.yml$"]
"fileMatch": ["^ci/.+\\.ya?ml$"]
}
}