Skip to content

Added dependency

Added dependency #22

Workflow file for this run

name: Test Helm Chart
on:
pull_request:
types:
- opened
- review_requested
- reopened
workflow_dispatch:
workflow_call:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event.workflow_call.workflow_file }}"
cancel-in-progress: true
jobs:
vars:
name: Generation vars
runs-on: ubuntu-latest
outputs:
path_to_charts: ${{ steps.dynamic.outputs.PATH_TO_CHARS }}
steps:
- uses: actions/checkout@v4
- name: Check all charts
working-directory: charts
id: _tmp_path_to_charts
run: echo "value=$(echo "["$(find . -maxdepth 1 -mindepth 1 -type d ! -name "basic" -exec realpath {} \; | sed "s/.*/'&'/" | paste -sd, -)"]")" >> "$GITHUB_OUTPUT"
- name: Create dynamic vars
id: dynamic
run: |
echo "PATH_TO_CHARS=${{ steps._tmp_path_to_charts.outputs.value }}" >> "$GITHUB_OUTPUT"
lint-security-practices:
needs: [ vars ]
if: false
name: Check security by kyvenro
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Kyverno CLI
uses: kyverno/[email protected]
with:
release: 'v1.10.3'
- name: Check install
run: kyverno version
lint-k8s-good-practices:
needs: [ vars ]
name: Check valid schema in k8s by kubeconform # поглинена перевірка template, чи відповідають стандарту k8s
runs-on: ubuntu-latest
strategy:
matrix:
path: ${{ fromJson(needs.vars.outputs.path_to_charts) }}
steps:
- uses: actions/checkout@v4
- name: Install plugin
run: |
helm plugin install https://github.com/jtyr/kubeconform-helm
- name: Check valid helm
working-directory: ${{ matrix.path }}
run: |
helm kubeconform --verbose --summary .
lint-helm-chart-good-practices:
needs: [ vars ]
name: Check helm charts good practices # Поверхнева перевірка template. Не перевіряє, чи валідні template в k8s
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint - Best practices
working-directory: charts
run: helm lint *
lint-helm-install-in-k0s:
needs: [ vars, lint-k8s-good-practices, lint-helm-chart-good-practices ]
name: Check install helm chart in k0s
runs-on: ubuntu-latest
environment:
name: ${{ matrix.path }}
strategy:
matrix:
path: ${{ fromJson(needs.vars.outputs.path_to_charts) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Get last version k0s
id: last_tag_k0s
env:
DOCKERHUB_IMAGE: k0sproject/k0s
run: |
version=$(curl -L --fail "https://hub.docker.com/v2/repositories/${{ env.DOCKERHUB_IMAGE }}/tags/?page_size=1000" | \
jq '.results | .[] | .name' -r | \
sed 's/latest//' | \
sort --version-sort | \
tail -n 1)
echo "value=$version" >> $GITHUB_OUTPUT
- name: Create dir
run: mkdir -p ~/.kube
- name: Install requirements.txt
run: |
pip install -r requirements.txt
- name: UP Cluster
working-directory: scripts
run: |
python -m cli up-cluster --tag ${{ steps.last_tag_k0s.outputs.value }} --workers 2 --ready-wait --force > ~/.kube/config
- name: Check k0s version
run: kubectl version
- name: Check Ready all nodes
run: kubectl get nodes --no-headers
- name: Install Helm
uses: azure/setup-helm@v4
- name: Create values.yaml
run: |
echo ${{ vars.VALUES }} | base64 -d > values.yaml
- name: Install helm chart
run: |
helm install -g ${{ matrix.path }} -n helm-test --create-namespace -f values.yaml