Commit f6f2045c authored by Aleksey P's avatar Aleksey P
Browse files

feat: add postgresql helm upgrade options

parent b07dd4fd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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:
+2 −0
Original line number Diff line number Diff line
@@ -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 ~ |

+12 −0
Original line number Diff line number Diff line
@@ -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