mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 14:56:22 -03:00
Common Refactor
This commit is contained in:
38
.github/ct-install-config/chart_schema.yaml
vendored
Normal file
38
.github/ct-install-config/chart_schema.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: str()
|
||||
kubeVersion: str()
|
||||
apiVersion: str()
|
||||
appVersion: any(str(), num())
|
||||
version: str(required=True)
|
||||
upstream_version: any(str(), num(), required=False)
|
||||
description: str()
|
||||
type: str(required=False)
|
||||
home: str()
|
||||
icon: str()
|
||||
sources: list(str(), required=False)
|
||||
dependencies: list(include('dependency'), required=False)
|
||||
deprecated: bool(required=False)
|
||||
engine: str(required=False)
|
||||
condition: str(required=False)
|
||||
keywords: list(str(), required=False)
|
||||
tags: str(required=False)
|
||||
maintainers: list(include('maintainer'))
|
||||
annotations: map(str(), str(), required=False)
|
||||
---
|
||||
maintainer:
|
||||
name: str()
|
||||
email: str(required=False)
|
||||
url: str(required=True)
|
||||
---
|
||||
dependency:
|
||||
name: str()
|
||||
repository: str()
|
||||
version: str()
|
||||
condition: str(required=False)
|
||||
tags: list(str(), required=False)
|
||||
import-values: any(list(str()), list(include('import-value')), required=False)
|
||||
enabled: bool(required=False)
|
||||
alias: str(required=False)
|
||||
---
|
||||
import-value:
|
||||
child: str()
|
||||
parent: str()
|
||||
7
.github/ct-install-config/ct-install.yaml
vendored
Normal file
7
.github/ct-install-config/ct-install.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
remote: origin
|
||||
target-branch: master
|
||||
chart-yaml-schema: .github/ct-install-config/chart_schema.yaml
|
||||
chart-dirs:
|
||||
- library
|
||||
- charts
|
||||
excluded-charts: []
|
||||
7
.github/ct-install-config/ct-lint.yaml
vendored
Normal file
7
.github/ct-install-config/ct-lint.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
remote: origin
|
||||
target-branch: master
|
||||
helm-extra-args: --timeout 600s --debug
|
||||
chart-yaml-schema: .github/ct-install-config/chart_schema.yaml
|
||||
chart-dirs:
|
||||
- library
|
||||
excluded-charts: []
|
||||
42
.github/ct-install-config/lint-conf.yaml
vendored
Normal file
42
.github/ct-install-config/lint-conf.yaml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
rules:
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
min-spaces-inside-empty: -1
|
||||
max-spaces-inside-empty: -1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
min-spaces-inside-empty: -1
|
||||
max-spaces-inside-empty: -1
|
||||
colons:
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
commas:
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
comments:
|
||||
require-starting-space: true
|
||||
min-spaces-from-content: 2
|
||||
document-end: disable
|
||||
document-start: disable # No --- to start a file
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
max-end: 0
|
||||
hyphens:
|
||||
max-spaces-after: 1
|
||||
indentation:
|
||||
spaces: consistent
|
||||
indent-sequences: whatever # - list indentation will handle both indentation and without
|
||||
check-multi-line-strings: false
|
||||
key-duplicates: enable
|
||||
line-length: disable # Lines can be any length
|
||||
new-line-at-end-of-file: enable
|
||||
new-lines:
|
||||
type: unix
|
||||
trailing-spaces: enable
|
||||
truthy:
|
||||
level: warning
|
||||
7
.github/ct-install.yaml
vendored
7
.github/ct-install.yaml
vendored
@@ -1,7 +0,0 @@
|
||||
remote: origin
|
||||
target-branch: main
|
||||
helm-extra-args: --timeout 600s --debug
|
||||
chart-dirs:
|
||||
- helper-charts
|
||||
chart-repos:
|
||||
- k8s-at-home-libraries=https://library-charts.truecharts.org
|
||||
7
.github/ct-lint.yaml
vendored
7
.github/ct-lint.yaml
vendored
@@ -1,7 +0,0 @@
|
||||
remote: origin
|
||||
target-branch: main
|
||||
helm-extra-args: --timeout 600s
|
||||
chart-dirs:
|
||||
- charts
|
||||
chart-repos:
|
||||
- truecharts-libraries=https://library-charts.truecharts.org
|
||||
99
.github/workflows/charts-lint-test.yaml
vendored
99
.github/workflows/charts-lint-test.yaml
vendored
@@ -1,99 +0,0 @@
|
||||
name: "Charts: Lint and test"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/charts-lint-test.yaml'
|
||||
- 'charts/**'
|
||||
- 'helper-charts/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint charts
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
changed: ${{ steps.list-changed.outputs.changed }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
run: |
|
||||
changed=$(ct list-changed --config .github/ct-lint.yaml)
|
||||
if [[ -n "$changed" ]]; then
|
||||
echo "::set-output name=changed::true"
|
||||
fi
|
||||
- name: Run chart-testing (lint)
|
||||
id: lint
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
run: ct lint --config .github/ct-lint.yaml
|
||||
|
||||
unittest:
|
||||
needs:
|
||||
- lint
|
||||
name: Run unit tests
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16
|
||||
cd helper-charts/common-test/
|
||||
helm dependency update
|
||||
helm unittest -f "tests/**/*_test.yaml" .
|
||||
install:
|
||||
needs:
|
||||
- lint
|
||||
name: Install charts
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
||||
|
||||
- name: Create k3d cluster
|
||||
uses: nolar/setup-k3d-k3s@v1
|
||||
with:
|
||||
version: v1.22.4+k3s1
|
||||
if: needs.lint.outputs.changed == 'true'
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
if: needs.lint.outputs.changed == 'true'
|
||||
run: ct install --all --config .github/ct-install.yaml --debug
|
||||
2
.github/workflows/common.release.yaml
vendored
2
.github/workflows/common.release.yaml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'charts/**'
|
||||
- 'charts/*'
|
||||
|
||||
jobs:
|
||||
release-charts:
|
||||
|
||||
191
.github/workflows/common_library_tests.yaml
vendored
Normal file
191
.github/workflows/common_library_tests.yaml
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
name: Common Library Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- library/**
|
||||
- .github/workflows/common_library_tests.yaml
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Common
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
|
||||
helm-version:
|
||||
- v3.9.4
|
||||
- v3.10.3
|
||||
- v3.11.0-rc.1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
||||
with:
|
||||
version: ${{ matrix.helm-version }}
|
||||
|
||||
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
||||
|
||||
|
||||
- name: Run chart-testing (lint)
|
||||
run: |
|
||||
ct lint --config .github/ct-install-config/ct-lint.yaml \
|
||||
--lint-conf .github/ct-install-config/lint-conf.yaml \
|
||||
--charts library/common-test \
|
||||
--debug
|
||||
|
||||
|
||||
|
||||
|
||||
unittest:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
helmunitversion: 0.2.11
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
|
||||
helm-version:
|
||||
- v3.9.4
|
||||
- v3.10.3
|
||||
- v3.11.0-rc.1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Cache helm plugins
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
/home/runner/.local/share/helm/plugins/helm-unittest
|
||||
key: helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}-${{ hashFiles('/home/runner/.local/share/helm/plugins/helm-unittest') }}
|
||||
restore-keys: |
|
||||
helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}-${{ hashFiles('/home/runner/.local/share/helm/plugins/helm-unittest') }}
|
||||
helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
||||
with:
|
||||
version: ${{ matrix.helm-version }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
helm unittest -h || helm plugin install https://github.com/quintush/helm-unittest --version "v${helmunitversion}"
|
||||
cd library/common-test/
|
||||
helm dependency update
|
||||
helm unittest --helm3 -f "tests/*/*.yaml" .
|
||||
|
||||
install:
|
||||
needs:
|
||||
- lint
|
||||
name: Install Charts
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# We run tests on k3s version of latest SCALE release, SCALE nightly and manually defined "latest"
|
||||
k3s-version:
|
||||
- v1.25.3+k3s1
|
||||
- v1.26.0+k3s1
|
||||
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
|
||||
helm-version:
|
||||
- v3.9.4
|
||||
- v3.10.3
|
||||
- v3.11.0-rc.1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
||||
with:
|
||||
version: ${{ matrix.helm-version }}
|
||||
|
||||
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
||||
|
||||
- name: Create k3d cluster - Attempt 1/3
|
||||
continue-on-error: true
|
||||
id: createc1
|
||||
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: ${{ matrix.k3s-version }}
|
||||
# Flags found here https://github.com/k3d-io/k3d
|
||||
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||
|
||||
- name: Wait 10 second to retry
|
||||
if: steps.createc1.outcome=='failure'
|
||||
run: |
|
||||
sleep 10
|
||||
|
||||
- name: Create k3d cluster - Attempt 2/3
|
||||
continue-on-error: true
|
||||
if: steps.createc1.outcome=='failure'
|
||||
id: createc2
|
||||
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: ${{ matrix.k3s-version }}
|
||||
# Flags found here https://github.com/k3d-io/k3d
|
||||
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||
|
||||
- name: Wait 10 second to retry
|
||||
if: steps.createc2.outcome=='failure'
|
||||
run: |
|
||||
sleep 10
|
||||
|
||||
|
||||
- name: Create k3d cluster - Attempt 3/3
|
||||
id: createc3
|
||||
if: steps.createc2.outcome=='failure'
|
||||
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: ${{ matrix.k3s-version }}
|
||||
# Flags found here https://github.com/k3d-io/k3d
|
||||
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||
|
||||
- name: Move CI values
|
||||
run: |
|
||||
mv library/common-test/ci library/common-test/runtests
|
||||
|
||||
- name: Run chart-testing (install) - Basic Values
|
||||
run: |
|
||||
mv -f library/common-test/runtests/basic-values.yaml library/common-test/values.yaml
|
||||
ct install --config .github/ct-install-config/ct-install.yaml \
|
||||
--charts library/common-test \
|
||||
--debug
|
||||
|
||||
- name: Run chart-testing (install) - persistence Values
|
||||
run: |
|
||||
mv -f library/common-test/runtests/persistence-values.yaml library/common-test/values.yaml
|
||||
ct install --config .github/ct-install-config/ct-install.yaml \
|
||||
--charts library/common-test \
|
||||
--debug
|
||||
|
||||
- name: Run chart-testing (install) - rbac Values
|
||||
run: |
|
||||
mv -f library/common-test/runtests/rbac-values.yaml library/common-test/values.yaml
|
||||
ct install --config .github/ct-install-config/ct-install.yaml \
|
||||
--charts library/common-test \
|
||||
--debug
|
||||
27
.github/workflows/lint.yaml
vendored
Normal file
27
.github/workflows/lint.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: flake8
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8
|
||||
- name: Setup flake8 config
|
||||
run: |
|
||||
echo '[flake8]' > setup.cfg
|
||||
echo 'max-line-length = 120' >> setup.cfg
|
||||
- name: Analysing the code with flake8
|
||||
run: |
|
||||
find -name upgrade_strategy -exec sh -c "flake8 {} && exit 0 || echo $? > .exit_status" \;
|
||||
test -f .exit_status && rm .exit_status && exit 1; exit 0;
|
||||
Reference in New Issue
Block a user