Skip to content

Commit

Permalink
chore: chart testing release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Feb 3, 2025
1 parent 3e8b66d commit 1e0bae0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,22 @@ jobs:
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
- name: Run chart-testing (install changed only)
run: |
ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m"
if: ${{ !contains(github.event.pull_request.labels.*.name, 'next-release') && !contains(github.event.pull_request.labels.*.name, 'needs-testing') }}
# - name: Run chart-testing (install changed only)
# run: |
# ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m"
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'next-release') && !contains(github.event.pull_request.labels.*.name, 'needs-testing') }}

- name: Run chart-testing (install changed next-release only)
# - name: Run chart-testing (install changed next-release only)
# run: |
# yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' ./charts/lagoon-core/ci/linter-values.yaml ./charts/lagoon-core/ci/testlagoon-main-override.yaml
# ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m"
# if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') }}

- name: Run chart-testing (install changed only)
run: |
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' ./charts/lagoon-core/ci/linter-values.yaml ./charts/lagoon-core/ci/testlagoon-main-override.yaml
ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m"
if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'current-release') && !contains(github.event.pull_request.labels.*.name, 'needs-testing') }}

# - name: Run chart-testing (upgrade changed next-release only)
# run: |
Expand All @@ -102,7 +108,7 @@ jobs:

- name: Run chart-testing (install all charts when required)
run: ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m" --all
if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') || contains(github.event.pull_request.labels.*.name, 'needs-testing') }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'current-release') || contains(github.event.pull_request.labels.*.name, 'needs-testing') }}

linter-artifacthub:
runs-on: ubuntu-latest
Expand Down
48 changes: 32 additions & 16 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: |
docker network create kind
LAGOON_KIND_CIDR_BLOCK=$(docker network inspect kind | jq '. [0].IPAM.Config[0].Subnet' | tr -d '"')
Expand All @@ -75,7 +76,8 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
with:
version: v0.24.0
node_image: kindest/node:v1.30.4@sha256:976ea815844d5fa93be213437e3ff5754cd599b040946b5cca43ca45c2047114
Expand All @@ -86,7 +88,8 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: |
LAGOON_KIND_CIDR_BLOCK=$(docker network inspect kind | jq '. [0].IPAM.Config[0].Subnet' | tr -d '"')
NODE_IP=$(echo ${LAGOON_KIND_CIDR_BLOCK%???} | awk -F'.' '{print $1,$2,$3,240}' OFS='.')
Expand All @@ -97,7 +100,8 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: |
helm repo add harbor https://helm.goharbor.io
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
Expand All @@ -114,7 +118,8 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: |
cd /tmp
curl -sSLO https://github.com/itchyny/gojq/releases/download/v0.12.16/gojq_v0.12.16_linux_amd64.tar.gz
Expand All @@ -129,18 +134,27 @@ jobs:
sudo cp /tmp/kubens /usr/local/bin/kubens
sudo ln -s $(which kubectl) /usr/local/bin/kc
# - name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (needs-testing)
# if: |
# (steps.list-changed.outputs.changed == 'true' && !contains(github.event.pull_request.labels.*.name, 'next-release')) ||
# (contains(github.event.pull_request.labels.*.name, 'needs-testing'))
# run: |
# make install-lagoon
# make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}]

# - name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (next-release)
# if: |
# (steps.list-changed.outputs.changed == 'true') &&
# (contains(github.event.pull_request.labels.*.name, 'next-release'))
# run: |
# yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' ./charts/lagoon-core/ci/linter-values.yaml ./charts/lagoon-core/ci/testlagoon-main-override.yaml
# make install-lagoon IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main
# make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}] IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main

- name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (needs-testing)
if: |
(steps.list-changed.outputs.changed == 'true' && !contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(steps.list-changed.outputs.changed == 'true' && !contains(github.event.pull_request.labels.*.name, 'current-release')) ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
run: |
make install-lagoon
make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}]
- name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (next-release)
if: |
(steps.list-changed.outputs.changed == 'true') &&
(contains(github.event.pull_request.labels.*.name, 'next-release'))
run: |
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' ./charts/lagoon-core/ci/linter-values.yaml ./charts/lagoon-core/ci/testlagoon-main-override.yaml
make install-lagoon IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main
Expand All @@ -150,14 +164,16 @@ jobs:
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: docker system prune -f -a --volumes

- name: Run chart-testing (install) on lagoon-test
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing')) ||
(contains(github.event.pull_request.labels.*.name, 'next-release'))
(contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'current-release'))
run: |
ct lint --config ./test-suite-run.ct.yaml
ct install --config ./test-suite-run.ct.yaml --helm-extra-args "--timeout 60m"
Expand Down

0 comments on commit 1e0bae0

Please sign in to comment.