diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4d351d489352954249de1223b61c405c88da5d0..e3af3d4e2f526bde549049ead72339aa4a6a3b04 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ include: - - project: 'cta-computing/dpps/aiv/deployment-components/dpps-aiv-toolkit' - ref: more-info-on-failure - file: '.ci-functions.yml' + - project: 'cta-computing/dpps/aiv/dpps-aiv-toolkit' + ref: d6df839da05f376467a49b24b2727036862be99d + file: 'ci-functions.yml' # - project: 'cta-computing/dpps/aiv/test-report' # ref: automated-test-reports-vs # file: '.ci-functions.yml' @@ -12,14 +12,42 @@ variables: CHART_NAME: cvmfs CHART_VERSION: 0.1.0 DPPS_AIV_TOOLKIT_DIR: dpps-aiv-toolkit - DOCKER_IMAGE_CONTEXT: cvmfs/stratum0 - + stages: - lint - build - sign - - test + - tests - sonarqube - publish # - report +hadolint: + rules: + - when: never + +sign: + rules: + - when: never + +build-docs: + rules: + - when: never + +pages: + rules: + - when: never + + +build: + retry: 2 + variables: + CI_HARBOR_REGISTRY_IMAGE: harbor.cta-observatory.org/dpps/$CI_PROJECT_NAME-stratum0:$CI_COMMIT_REF_NAME + DOCKER_IMAGE_CONTEXT: cvmfs/stratum0 + +build-stratum1: + retry: 2 + extends: build + variables: + CI_HARBOR_REGISTRY_IMAGE: harbor.cta-observatory.org/dpps/$CI_PROJECT_NAME-stratum1:$CI_COMMIT_REF_NAME + DOCKER_IMAGE_CONTEXT: cvmfs/stratum1 diff --git a/.gitmodules b/.gitmodules index 4c38ee4531e714eaf46f412b662e20fb6b8afb3f..7b3b9005f59e608924055048a76b2ea99b04cbcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "dpps-aiv-toolkit"] path = dpps-aiv-toolkit - url = https://gitlab.cta-observatory.org/cta-computing/dpps/aiv/deployment-components/dpps-aiv-toolkit.git + url = ../dpps-aiv-toolkit.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..98b8c5d4f5ba62263ba12276dea8079a205903ed --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,31 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 # Use the ref you want to point at + hooks: + - id: trailing-whitespace + exclude: '(.*\.fits(\.fz)?)|(.*.patch.*)$' + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: end-of-file-fixer + exclude: '(.*\.fits(\.fz)?)|(.*.patch.*)$' + + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli + + - repo: local + hooks: + - id: CI yaml check + args: [ dpps-aiv-toolkit ] + #args: [ test-report, dpps-aiv-toolkit ] + name: CI yaml check + description: CI yaml check + language: script + entry: dpps-aiv-toolkit/cicheck.sh + pass_filenames: true + files: ^.gitlab-ci.yml$ + always_run: true diff --git a/Makefile b/Makefile index 384f8d549ada7438cd24a0f96cfca554efd28bc2..2241dbcd68fa92c39e21eb1746f279c684290a51 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,4 @@ -test-chart destroy-k8s-cluster: - make -f dpps-aiv-toolkit/Makefile $@ +### +export CHART_NAME=cvmfs +export CHART_LOCATION=chart +include dpps-aiv-toolkit/Makefile diff --git a/chart/README.md b/chart/README.md index 91b84692fa5daba90910ac42e091dda036771a17..0540133d2fbf49ec5fe2b7ca9ee9d8d053bae508 100644 --- a/chart/README.md +++ b/chart/README.md @@ -1 +1 @@ -This is a prototype for CVMFS stratum 0 server. \ No newline at end of file +This is a prototype for CVMFS stratum 0 server. diff --git a/chart/templates/bootstrap.yaml b/chart/templates/bootstrap.yaml index cf38e2612af832f4fcbfacb4d3a2927e585fbafd..930f39f002e5e4aa3f37ec9192c545120e94afb7 100644 --- a/chart/templates/bootstrap.yaml +++ b/chart/templates/bootstrap.yaml @@ -11,7 +11,7 @@ annotations: spec: # TODO: maybe make unique name instead o ttlSecondsAfterFinished: 60 - template: + template: metadata: labels: app: {{ include "cvmfs.fullname" . }}-mkfs @@ -20,7 +20,7 @@ spec: containers: - name: {{ include "cvmfs.fullname" . }}-mkfs image: bitnami/kubectl:1.31.1 - command: + command: - bash - -c - | @@ -42,4 +42,4 @@ spec: claimName: {{ include "cvmfs.fullname" . }}-keys - name: data persistentVolumeClaim: - claimName: {{ include "cvmfs.fullname" . }}-data \ No newline at end of file + claimName: {{ include "cvmfs.fullname" . }}-data diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index bf865f73b0e19a1031d6528a337f543a2bad0f33..eff6de99a5a9d64993949ca3311d24a058d9020d 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -78,7 +78,7 @@ spec: persistentVolumeClaim: claimName: {{ include "cvmfs.fullname" . }}-data - name: cgroup - hostPath: + hostPath: path: /sys/fs/cgroup type: Directory {{- with .Values.nodeSelector }} @@ -93,4 +93,3 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - diff --git a/chart/templates/pvc.yaml b/chart/templates/pvc.yaml index 437e2765eff17966e77bd6e33100e9c87168551e..cb6e90924a61e80d81c83c06da7791c7644af10f 100644 --- a/chart/templates/pvc.yaml +++ b/chart/templates/pvc.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: {{ include "cvmfs.fullname" . }}-keys - namespace: {{ .Release.Namespace | quote }} - labels: + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "cvmfs.labels" . | nindent 4 }} spec: accessModes: @@ -18,8 +18,8 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: {{ include "cvmfs.fullname" . }}-data - namespace: {{ .Release.Namespace | quote }} - labels: + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "cvmfs.labels" . | nindent 4 }} spec: accessModes: diff --git a/chart/templates/serviceaccount.yaml b/chart/templates/serviceaccount.yaml index ce9e92d68e4fd20faf41b43d358667e06d568b7c..ac73c94778a718e7493e5a74d02001df098b419b 100644 --- a/chart/templates/serviceaccount.yaml +++ b/chart/templates/serviceaccount.yaml @@ -32,4 +32,4 @@ roleRef: subjects: - kind: ServiceAccount name: exec-pods - namespace: default \ No newline at end of file + namespace: default diff --git a/chart/templates/tests/test-connection.yaml b/chart/templates/tests/test-connection.yaml index 2fc67fd45909c3632468052b8ecc0122b7b3b61f..0cb8ce8baab992dccb194caadac8dc8e757b5fb6 100644 --- a/chart/templates/tests/test-connection.yaml +++ b/chart/templates/tests/test-connection.yaml @@ -13,4 +13,3 @@ spec: command: ['wget'] args: ['{{ include "cvmfs.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never - diff --git a/chart/templates/tests/test-publish.yaml b/chart/templates/tests/test-publish.yaml index 24e0002169662c35a0a8ae2def7b0e0acc38260d..11fdc8aa56b86897a4084dbd4181d4750e9e1a92 100644 --- a/chart/templates/tests/test-publish.yaml +++ b/chart/templates/tests/test-publish.yaml @@ -11,8 +11,8 @@ spec: containers: - name: publisher image: bitnami/kubectl:1.31.1 - command: - - bash + command: + - bash - -c - | kubectl exec deployment/{{ include "cvmfs.fullname" . }} -- bash -c ' @@ -32,8 +32,12 @@ spec: cvmfs_server publish # TODO: run tests + touch /tmp/report.xml + touch /tmp/coverage.xml + curl -T /tmp/coverage.xml http://testkit:8000/coverage.xml + curl -T /tmp/report.xml http://testkit:8000/report.xml ' - touch /test-results/report.xml + volumeMounts: - name: test-results diff --git a/cvmfs/stratum1/Dockerfile b/cvmfs/stratum1/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8cca9cf0cdb0dd444852e4b6f23b1ede129af4df --- /dev/null +++ b/cvmfs/stratum1/Dockerfile @@ -0,0 +1,11 @@ +FROM almalinux:9 + +VOLUME ["/var/spool/cvmfs"] +VOLUME ["/srv/cvmfs"] + +RUN dnf -y install epel-release https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm \ + && dnf install -y cvmfs cvmfs-server squid \ + && dnf install -y mod_wsgi \ + && systemctl enable httpd + +CMD ["/usr/sbin/init"] diff --git a/cvmfs/stratum1/server.local b/cvmfs/stratum1/server.local new file mode 100644 index 0000000000000000000000000000000000000000..814197f559b5fc25ef491dfef4d86b1dd76f8bc7 --- /dev/null +++ b/cvmfs/stratum1/server.local @@ -0,0 +1 @@ +CVMFS_GEO_DB_FILE=NONE diff --git a/dpps-aiv-toolkit b/dpps-aiv-toolkit index a203ee0d602bf59e56f2a4fed3163535c201e83b..d6df839da05f376467a49b24b2727036862be99d 160000 --- a/dpps-aiv-toolkit +++ b/dpps-aiv-toolkit @@ -1 +1 @@ -Subproject commit a203ee0d602bf59e56f2a4fed3163535c201e83b +Subproject commit d6df839da05f376467a49b24b2727036862be99d