diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1cc865ad903f7ee09c163cfcbe0319c84a0b18c4..27f7276323d8e9cea61d86fd4821d90961b1abf2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ stages: + - test - build image - test image - build chart @@ -20,6 +21,16 @@ include: - project: 'cspp_geo/geosphere/geosphere-deploy' file: '/helpers/build_chart.yaml' +precommit: + # steal build image which includes python and + # use the tags to run on our usual runners + extends: .build_image + stage: test + before_script: [] + script: + - python3 -m pip install --root-user-action=ignore --break-system-packages pre-commit + - pre-commit run -a + build_image_mapserver: extends: .build_image variables: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ade95c2e57eae04278992efff8ddd516d5a8ac2..04b0cdb7466ca189e7ac724d54af4191131ab612 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,20 @@ exclude: '^$' fail_fast: false repos: + - repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update + rev: v0.4.0post1 + hooks: + # Fix failure with `pre-commit autoupdate` + - id: pre-commit-update + args: [ --dry-run ] - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear, mccabe] args: [--max-complexity, "10"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -16,10 +22,18 @@ repos: args: [--unsafe] exclude: ^chart/.*/templates/.*\.yaml - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.4.2-1 + rev: v3.9.0-1 hooks: # Choose one of: - id: shfmt # native (requires Go to build) args: ["-i", "4"] #- id: shfmt-docker # Docker image (requires Docker to run) # + - repo: local + hooks: + - id: helm-lint + name: "Lint Helm Chart" + entry: bash -c 'helm dependency update chart/* && helm lint chart/* --strict --with-subcharts' + language: system + files: ^chart/ + pass_filenames: false diff --git a/chart/geosphere-mapserver/templates/deployment.yaml b/chart/geosphere-mapserver/templates/deployment.yaml index 99b53aeb74f2b21c76514e02ed9550fda001c16c..9f030a51f8644cec5da79b1c126a153fe8d738ff 100644 --- a/chart/geosphere-mapserver/templates/deployment.yaml +++ b/chart/geosphere-mapserver/templates/deployment.yaml @@ -1,3 +1,5 @@ +{{/* Overwrite local values with globals */}} +{{- $Values:= mergeOverwrite $.Values $.Values.global }} apiVersion: apps/v1 kind: Deployment metadata: @@ -42,6 +44,11 @@ spec: secret: secretName: {{ .Values.database.postgresPasswordSecret }} {{- end }} + {{- if .Values.geosphereSettings.existingConfigMap }} + - name: settings-volume + configMap: + name: {{ .Values.geosphereSettings.existingConfigMap }} + {{- end }} containers: - name: {{ .Chart.Name }} securityContext: @@ -104,6 +111,10 @@ spec: name: {{ .Values.imageSource.s3Secret }} key: {{ .Values.imageSource.s3SecretKey}} {{- end }} + {{- if .Values.geosphereSettings.existingConfigMap }} + - name: GEOSPHERE_CONFIG + value: "/etc/geosphere-settings/{{ .Values.geosphereSettings.settingsFilename }}" + {{- end }} volumeMounts: - name: src mountPath: "/data" @@ -116,6 +127,10 @@ spec: mountPath: "/secrets" readOnly: true {{- end }} + {{- if .Values.geosphereSettings.existingConfigMap }} + - name: settings-volume + mountPath: /etc/geosphere-settings + {{- end }} ports: - name: http containerPort: 80 diff --git a/chart/geosphere-mapserver/values.yaml b/chart/geosphere-mapserver/values.yaml index b881c55c1454113a2ca7393d98c0f6b4dc9163d0..df72314a92a0810cd199790f72dc37633aa84ed6 100644 --- a/chart/geosphere-mapserver/values.yaml +++ b/chart/geosphere-mapserver/values.yaml @@ -2,12 +2,19 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +global: {} replicaCount: 1 image: repository: gitlab.ssec.wisc.edu:5555/cspp_geo/geosphere/geosphere-mapserver/geosphere-mapserver pullPolicy: IfNotPresent +geosphereSettings: + # -- ConfigMap to mount as files containing a custom Settings YAML file + existingConfigMap: "" + # -- Key in existingConfigMap that should be used as the Settings YAML file + settingsFilename: "settings.yaml" + # Filter products to support based on the following # empty list => use defaults products: []