Skip to content

Commit bb77a8b

Browse files
committed
Add S3/Swift object storage config and other configs from nextcloud/docker
- Add new S3 test to ci. - Add nextcloud.trustedDomains - Clean up run-test job to test Signed-off-by: jessebot <[email protected]>
1 parent bf6cc4a commit bb77a8b

File tree

14 files changed

+644
-175
lines changed

14 files changed

+644
-175
lines changed

.github/minio_test_values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## minio helm chart values for use in ci tests:
2+
# https://github.com/minio/minio/blob/master/helm/minio/values.yaml
3+
4+
# make service name predictable
5+
fullnameOverride: minio
6+
7+
## minio mode, i.e. standalone or distributed
8+
mode: standalone
9+
10+
## Configure resource requests and limits
11+
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
12+
resources:
13+
requests:
14+
memory: 1Gi
15+
16+
## Enable persistence using Persistent Volume Claims
17+
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
18+
persistence:
19+
enabled: false
20+
21+
# default credentials
22+
rootUser: nextcloud
23+
rootPassword: rootpass123

.github/test_upload_job.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: create-nextcloud-file
6+
namespace: nextcloud
7+
spec:
8+
template:
9+
metadata:
10+
name: create-nextcloud-file
11+
spec:
12+
containers:
13+
- name: create-nextcloud-file
14+
image: curlimages/curl
15+
command:
16+
- /bin/sh
17+
- -c
18+
- |
19+
echo "testing123" > test_upload.txt && \
20+
curl \
21+
-w "%{http_code}" \
22+
-u admin:changeme \
23+
-T test_upload.txt \
24+
"http://nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/admin/test_upload.txt" && \
25+
echo -e "\nTried to uploaded a file, test_upload.txt, to Nextcloud."
26+
restartPolicy: Never

.github/workflows/lint-test.yaml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
if: steps.list-changed.outputs.changed == 'true'
5757
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
5858

59-
run-tests:
59+
test:
6060
runs-on: ubuntu-22.04
6161
needs: [changes, lint]
6262
# only run this job if there are helm chart file changes
@@ -82,6 +82,12 @@ jobs:
8282
- name: Horizontal Pod Autoscaling Enabled
8383
helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"'
8484

85+
# test the helm chart with s3 as the primary storage
86+
- name: S3 Enabled as Primary Storage
87+
# we need to skip the clean up so we can test adding a file
88+
helm_args: |
89+
--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]='*'"
90+
8591
steps:
8692
- name: Checkout
8793
uses: actions/checkout@v4
@@ -112,15 +118,43 @@ jobs:
112118
uses: helm/[email protected]
113119
if: steps.list-changed.outputs.changed == 'true'
114120

121+
- name: Install MinIO for testing S3 as Primary Storage
122+
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
123+
# installs minio community helm chart here:
124+
# https://github.com/minio/minio/tree/master/helm/minio
125+
run: |
126+
helm repo add minio https://charts.min.io/ && \
127+
helm install minio \
128+
--namespace nextcloud \
129+
--create-namespace \
130+
--wait \
131+
--wait-for-jobs \
132+
--timeout 2m0s \
133+
--values .github/minio_test_values.yaml \
134+
minio/minio
135+
115136
- name: Run chart-testing (install ${{ matrix.test_cases.name }})
116137
id: install
117138
if: steps.list-changed.outputs.changed == 'true'
118139
run: ct install --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }}
119140

141+
- name: Try adding a file to Nextcloud
142+
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
143+
# applies a kubernetes job that uploads a file and then checks log of finished pod
144+
run: |
145+
kubectl config set-context --current --namespace=nextcloud && \
146+
kubectl apply -f ./.github/test_upload_job.yaml --wait=true && \
147+
sleep 2 && \
148+
kubectl wait --for=condition=Complete --timeout=2m job/create-nextcloud-file && \
149+
echo "Here's the logs from the job:" && \
150+
kubectl logs --tail=-1 -f -l batch.kubernetes.io/job-name=create-nextcloud-file && \
151+
echo "Here's the logs from the nextcloud pod:" && \
152+
kubectl logs -l app.kubernetes.io/name=nextcloud
153+
120154
summary:
121155
runs-on: ubuntu-latest-low
122-
needs: [changes, run-tests]
156+
needs: [changes, test]
123157
if: always()
124158
steps:
125159
- name: Summary
126-
run: if ${{ needs.changes.outputs.src != 'false' && needs.run-tests.result != 'success' }}; then exit 1; fi
160+
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

charts/nextcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: nextcloud
3-
version: 5.3.2
3+
version: 5.4.0
44
appVersion: 29.0.4
55
description: A file sharing server that puts the control and security of your own data back into your hands.
66
keywords:

0 commit comments

Comments
 (0)