Skip to content

Commit

Permalink
fix(ci): use default chart-testing logic for different testcases
Browse files Browse the repository at this point in the history
Signed-off-by: WrenIX <[email protected]>
  • Loading branch information
wrenix committed Aug 11, 2024
1 parent dff8e46 commit 278f42d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 101 deletions.
35 changes: 4 additions & 31 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,6 @@ jobs:
needs: [changes, lint]
# only run this job if there are helm chart file changes
if: needs.changes.outputs.src != 'false'
strategy:
# continue with all the other jobs even if one fails
fail-fast: false
matrix:
# each item in this list is a job with an isolated test VM
test_cases:
# test the plain helm chart with nothing changed
- name: 'Default - no custom values'

# test the helm chart with postgresql subchart enabled
- name: PostgreSQL Enabled
helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=postgresql.global.postgresql.auth.password=testing123456 --set=internalDatabase.enabled=false --set=externalDatabase.enabled=True --set=externalDatabase.type=postgresql --set=externalDatabase.password=testing12345"'

# test the helm chart with nginx container enabled
- name: Nginx Enabled
helm_args: '--helm-extra-set-args "--set=image.flavor=fpm --set=nginx.enabled=true"'

# test the helm chart with horizontal pod autoscaling enabled
- name: Horizontal Pod Autoscaling Enabled
helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"'

# test the helm chart with s3 as the primary storage
- name: S3 Enabled as Primary Storage
# we need to skip the clean up so we can test adding a file
helm_args: |
--namespace nextcloud --skip-clean-up --helm-extra-set-args "--set=fullnameOverride=nextcloud --set=nextcloud.objectStore.s3.enabled=true --set=nextcloud.objectStore.s3.accessKey=nextcloud --set=nextcloud.objectStore.s3.secretKey=rootpass123 --set=nextcloud.objectStore.s3.host=minio.nextcloud.svc.cluster.local --set=nextcloud.objectStore.s3.port=9000 --set=nextcloud.objectStore.s3.ssl=false --set=nextcloud.objectStore.s3.bucket=nextcloud --set=nextcloud.objectStore.s3.usePathStyle=true --set=image.flavor=fpm --set=nginx.enabled=true --set=nextcloud.host=nextcloud --set=nextcloud.trustedDomains[0]='*'"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -119,7 +92,7 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'

- name: Install MinIO for testing S3 as Primary Storage
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# only used during ct-s3-as-primary-values.yaml
# installs minio community helm chart here:
# https://github.com/minio/minio/tree/master/helm/minio
run: |
Expand All @@ -133,13 +106,13 @@ jobs:
--values .github/tests/minio_test_values.yaml \
minio/minio
- name: Run chart-testing (install ${{ matrix.test_cases.name }})
- name: Run chart-testing (install all charts/nextcloud/ci/ct-*-values.yaml)
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }}
run: ct install --target-branch ${{ github.event.repository.default_branch }}

- name: Try adding a file to Nextcloud
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# only used during ct-s3-as-primary-values.yaml
# applies a kubernetes job that uploads a file and then checks log of finished pod
run: |
kubectl config set-context --current --namespace=nextcloud && \
Expand Down
19 changes: 0 additions & 19 deletions charts/nextcloud/ci/ct-all-enabled-values.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions charts/nextcloud/ci/ct-hpa-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
hpa:
enabled: true
minPods: 2
maxPods: 3
targetCPUUtilizationPercentage: 75
5 changes: 5 additions & 0 deletions charts/nextcloud/ci/ct-nginx-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image:
flavor: fpm

nginx:
enabled: true
12 changes: 12 additions & 0 deletions charts/nextcloud/ci/ct-postgresql-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
postgresql:
enabled: true
global:
postgresql:
auth:
password: testing123456
internalDatabase:
enabled: false
externalDatabase:
enabled: true
type: postgresql
password: testing123456
22 changes: 22 additions & 0 deletions charts/nextcloud/ci/ct-s3-as-primary-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fullnameOverride: nextcloud

nextcloud:
trustedDomains:
- '*'
host: "nextcloud"
objectStore:
s3:
enabled: true
accessKey: nextcloud
secretKey: rootpass123
host: minio.nextcloud.svc.cluster.local
port: 9000
ssl: false
bucket: nextcloud
usePathStyle: true

image:
flavor: fpm

nginx:
enabled: true
51 changes: 0 additions & 51 deletions charts/nextcloud/ci/ct-specials-values.yaml

This file was deleted.

0 comments on commit 278f42d

Please sign in to comment.