mirror of
https://github.com/truenas/charts.git
synced 2026-04-13 17:52:13 +08:00
NAS-121003 / 23.10 / Adapt charts CI and improve/fix common (#1011)
* Adapt charts CI and improve/fix common * add check on permissions contaienr * add postgres template * update comments * Update create_app.sh * add check * update script * auto gen item.yaml from Chart,yaml * rename readme on dest * duplicate readme from the same source * correct comment * reoder * remove extra space * keep both README and app-readme * update regex, to also allow 2 letter names, which is also valid * No need to check host network if there aren't any pod values * use same pattern as the pod.name label (not prepending release-name * update deps * add chart dirs to ci * Add a validation to check if there is any yaml errors after merging files * update charts path on ci * common/1.0.0/ -> common/ * update common-test dep path * temp update create_app script * make permissions container name configurable, incase we want to change order of execution * update naming convention * fix typo and a missed name change * do not allow `--` in names
This commit is contained in:
124
.github/workflows/charts_tests.yaml
vendored
Normal file
124
.github/workflows/charts_tests.yaml
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
name: Charts Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- library/**
|
||||
- '!library/common'
|
||||
- '!library/common-test'
|
||||
- .github/ct-install-config/**
|
||||
- '!.github/ct-install-config/common*'
|
||||
- .github/workflows/charts_test.yaml
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Charts
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
helm-version:
|
||||
- v3.9.4
|
||||
- v3.10.3
|
||||
- v3.11.1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
# Depth 0 is required for chart-testing to work properly
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # 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)
|
||||
id: lint
|
||||
run: |
|
||||
ct lint --config .github/ct-install-config/charts-ct-lint.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
|
||||
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
|
||||
helm-version:
|
||||
- v3.9.4
|
||||
- v3.11.1
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
# Depth 0 is required for chart-testing to work properly
|
||||
fetch-depth: 0
|
||||
|
||||
- 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: Run chart-testing (install)
|
||||
run: |
|
||||
ct install --config .github/ct-install-config/charts-ct-install.yaml
|
||||
42
.github/workflows/common_library_tests.yaml
vendored
42
.github/workflows/common_library_tests.yaml
vendored
@@ -3,7 +3,10 @@ name: Common Library Tests
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- library/**
|
||||
- library/common/
|
||||
- library/common-test/
|
||||
- .github/ct-install-config/common*.yaml
|
||||
- '!.github/ct-install-config/charts*'
|
||||
- .github/workflows/common_library_tests.yaml
|
||||
|
||||
jobs:
|
||||
@@ -21,7 +24,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
# Depth 0 is required for chart-testing to work properly
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
|
||||
@@ -38,10 +42,7 @@ jobs:
|
||||
- name: Run chart-testing (lint)
|
||||
id: 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
|
||||
ct lint --config .github/ct-install-config/common-ct-lint.yaml
|
||||
|
||||
unittest:
|
||||
needs:
|
||||
@@ -61,7 +62,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
# Depth 0 is required for chart-testing to work properly
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
||||
@@ -111,7 +113,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
# Depth 0 is required for chart-testing to work properly
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
||||
@@ -164,33 +167,14 @@ jobs:
|
||||
# Flags found here https://github.com/k3d-io/k3d
|
||||
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||
|
||||
# Install Kail to grab logs from tests, as there are cases ct-install fail to output logs
|
||||
- name: Install Kail
|
||||
run: |
|
||||
export KAIL_VERSION=v0.16.1
|
||||
wget https://github.com/boz/kail/releases/download/${KAIL_VERSION}/kail_${KAIL_VERSION}_linux_amd64.tar.gz
|
||||
tar -xvzf kail_${KAIL_VERSION}_linux_amd64.tar.gz
|
||||
chmod +x kail
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
run: |
|
||||
# This is done to improve speed of the tests, so we can run tests in parallel
|
||||
# Move all ci values on a temp location (or skip if already moved from another matrix job)
|
||||
mv library/common-test/ci library/common-test/runtests || echo "Nothing to move"
|
||||
|
||||
# Move one values.yaml to the correct location to run the test
|
||||
mv -f library/common-test/runtests/${{ matrix.values }} library/common-test/values.yaml
|
||||
|
||||
# Stat kail on the background to grab logs from tests
|
||||
./kail --ignore-ns kube-system >> /tmp/output.log &
|
||||
|
||||
# Actually run the test
|
||||
ct install --config .github/ct-install-config/ct-install.yaml \
|
||||
--charts library/common-test \
|
||||
--debug || (echo -e "\n\n--===PODLOGS===--\n\n" && \
|
||||
cat /tmp/output.log && \
|
||||
rm -f /tmp/output.log && exit 1)
|
||||
|
||||
kill $!
|
||||
echo -e "\n\n--===PODLOGS===--\n\n"
|
||||
cat /tmp/output.log
|
||||
rm -f /tmp/output.log
|
||||
ct install --config .github/ct-install-config/common-ct-install.yaml
|
||||
|
||||
Reference in New Issue
Block a user