diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml index 934ea103d765f06590d4d481dbc3e52a96532d68..ec6db8182c652c5b399ff2e12470a739cf852eb2 100644 --- a/.gitlab/ci/test.gitlab-ci.yml +++ b/.gitlab/ci/test.gitlab-ci.yml @@ -209,8 +209,11 @@ test-install-postgres: POSTGRES_PASSWORD: testing-password POSTGRES_DB: $CI_ENVIRONMENT_SLUG script: + - mkdir -p .gitlab + - "echo 'custom_key: custom_value' > .gitlab/auto-deploy-postgres-values.yaml" - auto-deploy download_chart - auto-deploy install_postgresql + - helm get values production-postgresql --namespace "$KUBE_NAMESPACE" --output json | grep -q '"custom_key":"custom_value"' || exit 1 - kubectl get statefulset production-postgresql -n $KUBE_NAMESPACE test-deploy: diff --git a/doc/api.md b/doc/api.md index 056baa9975dc191d02a27a1c2ed60bf5e48df3d4..6a52ec10e97cc93e6f8c56a2fa73d3d20925b151 100644 --- a/doc/api.md +++ b/doc/api.md @@ -132,6 +132,8 @@ Deploy an application | `POSTGRES_PASSWORD` | string | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v0.1.0 ~ | | `POSTGRES_USER` | string | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v0.1.0 ~ | | `POSTGRES_VERSION` | string | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v0.1.0 ~ | +| `POSTGRES_HELM_UPGRADE_EXTRA_ARGS` | string | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v2.0.2 ~ | +| `POSTGRES_HELM_UPGRADE_VALUES_FILE` | string | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v2.0.2 ~ | | `ROLLOUT_RESOURCE_TYPE` | integer | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v0.1.0 ~ | | `ROLLOUT_STATUS_DISABLED` | boolean | no | See [Customizing Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/customize.html). | v0.1.0 ~ | diff --git a/src/bin/auto-deploy b/src/bin/auto-deploy index a2be68afc1ab34ce223e1a1e68f5f057cf4fa6d1..3b4e9e8f99f9fc73a5a27576aa3f3c626224bf18 100755 --- a/src/bin/auto-deploy +++ b/src/bin/auto-deploy @@ -148,6 +148,16 @@ function install_postgresql() { debug_flag=('--debug') fi + local postgres_helm_values_args=() + local postgres_helm_values_file=${POSTGRES_HELM_UPGRADE_VALUES_FILE:-.gitlab/auto-deploy-postgres-values.yaml} + if [[ -f "${postgres_helm_values_file}" ]]; then + echo "Using PostgreSQL helm values file ${postgres_helm_values_file@Q}" + postgres_helm_values_args=(--values "${postgres_helm_values_file}") + else + echo "No PostgreSQL helm values file found at ${postgres_helm_values_file@Q}" + fi + + # shellcheck disable=SC2086 # POSTGRES_HELM_UPGRADE_EXTRA_ARGS -- double quote variables to prevent globbing helm upgrade --install \ --atomic \ "${debug_flag[@]}" \ @@ -158,6 +168,8 @@ function install_postgresql() { --set postgresqlPassword="$POSTGRES_PASSWORD" \ --set postgresqlDatabase="$POSTGRES_DB" \ --set image.tag="$POSTGRES_VERSION" \ + "${postgres_helm_values_args[@]}" \ + $POSTGRES_HELM_UPGRADE_EXTRA_ARGS \ --namespace="$KUBE_NAMESPACE" \ "$name" \ bitnami/postgresql