diff --git a/.drone.star b/.drone.star index 20d4b584c..c4f587bc2 100644 --- a/.drone.star +++ b/.drone.star @@ -193,7 +193,7 @@ def deployments(ctx): "kind": "pipeline", "type": "docker", "name": "k3d", - "steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx), + "steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx) + helmtest(ctx), "services": [ { "name": "k3d", @@ -256,3 +256,13 @@ def showPodsAfterInstall(config): "kubectl get ingress", ], }] + +def helmtest(ctx): + return [{ + "name": "helm-test", + "image": "docker.io/owncloudci/alpine", + "commands": [ + "export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", + "helm test --timeout 5m0s ocis --logs", + ], + }] diff --git a/charts/ocis/ci/deployment-values.yaml b/charts/ocis/ci/deployment-values.yaml index cde53cc3e..42adc4375 100644 --- a/charts/ocis/ci/deployment-values.yaml +++ b/charts/ocis/ci/deployment-values.yaml @@ -1,15 +1,15 @@ --- ingress: enabled: true - ingressClassName: nginx - annotations: - nginx.ingress.kubernetes.io/proxy-body-size: 1024m + #ingressClassName: nginx + #annotations: + # nginx.ingress.kubernetes.io/proxy-body-size: 1024m tls: - secretName: chart-example-tls hosts: - - ocis.owncloud.test + - host.k3d.internal -externalDomain: ocis.owncloud.test +externalDomain: host.k3d.internal logging: level: debug diff --git a/charts/ocis/templates/tests/execute-e2e.yaml b/charts/ocis/templates/tests/execute-e2e.yaml new file mode 100644 index 000000000..196d129ae --- /dev/null +++ b/charts/ocis/templates/tests/execute-e2e.yaml @@ -0,0 +1,71 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "e2e-tests" + labels: + {{- include "ocis.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + initContainers: + - name: git-checkout + image: owncloudci/nodejs:18 + workingDir: "/tests" + command: ['git'] + args: ['clone','-b','stable-7.1','--single-branch','--no-tags','https://github.com/owncloud/web.git'] + {{- include "ocis.containerSecurityContext" . | nindent 6 }} + resources: {{ toYaml .jobResources | nindent 8 }} + volumeMounts: + - name: test-dir + mountPath: /tests # we mount that volume only to apply fsGroup to that path + - name: install-pnpm + image: owncloudci/nodejs:18 + workingDir: "/tests/web" + command: ['bash'] + args: ['-c','pnpm config set store-dir ./.pnpm-store; pnpm install'] + {{- include "ocis.containerSecurityContext" . | nindent 6 }} + resources: {{ toYaml .jobResources | nindent 8 }} + volumeMounts: + - name: test-dir + mountPath: /tests # we mount that volume only to apply fsGroup to that path + - name: install-chromium + image: owncloudci/nodejs:18 + workingDir: "/tests/web" + command: ['bash'] + args: ['-c','pnpm exec playwright install chromium; pnpm exec playwright install-deps'] + {{- include "ocis.containerSecurityContext" . | nindent 6 }} + resources: {{ toYaml .jobResources | nindent 8 }} + volumeMounts: + - name: test-dir + mountPath: /tests # we mount that volume only to apply fsGroup to that path + + containers: + - name: e2e-tests + image: owncloudci/nodejs:18 + workingDir: "/tests/web" + command: ['pnpm'] + args: ['test:e2e:cucumber','tests/e2e/cucumber/features/*/*[!.oc10].feature'] + {{- include "ocis.containerSecurityContext" . | nindent 6 }} + resources: {{ toYaml .jobResources | nindent 8 }} + env: + - name: "BASE_URL_OCIS" + value: "host.k3d.internal" + - name: "HEADLESS" + value: "true" + - name: "BROWSER" + value: "chromium" + - name: "RETRY" + value: "1" + - name: "WEB_UI_CONFIG_FILE" + value: "/drone/src/tests/config/drone/ocis-config.json" + - name: "LOCAL_UPLOAD_DIR" + value: "/uploads" + volumeMounts: + - name: test-dir + mountPath: /tests # we mount that volume only to apply fsGroup to that path + + restartPolicy: Never + volumes: + - name: test-dir + emptyDir: {} + \ No newline at end of file diff --git a/charts/ocis/templates/tests/test-connection.yaml b/charts/ocis/templates/tests/test-connection.yaml new file mode 100644 index 000000000..1e942932d --- /dev/null +++ b/charts/ocis/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "ocis-test-connection" + labels: + {{- include "ocis.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: curl + image: curlimages/curl:8.4.0 + command: ['curl'] + args: ['-v','-k','https://{{ .Values.externalDomain }}/'] + {{- include "ocis.containerSecurityContext" . | nindent 6 }} + resources: {{ toYaml .jobResources | nindent 8 }} + restartPolicy: Never diff --git a/ci/k3d-drone.yaml b/ci/k3d-drone.yaml index dcde9bd61..14ad80f34 100644 --- a/ci/k3d-drone.yaml +++ b/ci/k3d-drone.yaml @@ -1,21 +1,19 @@ -apiVersion: k3d.io/v1alpha4 +apiVersion: k3d.io/v1alpha5 kind: Simple metadata: name: drone servers: 1 image: rancher/k3s:v1.28.3-k3s1 +ports: + - port: 443:443 + nodeFilters: + - loadbalancer options: k3s: extraArgs: - arg: --tls-san=k3d nodeFilters: - server:* - - arg: --disable=servicelb - nodeFilters: - - server:* - arg: --disable=metrics-server nodeFilters: - server:* - - arg: --disable=traefik - nodeFilters: - - server:* \ No newline at end of file