Loading .gitlab/ci/test.gitlab-ci.yml +31 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,37 @@ test-show-warning-for-legacy-in-cluster-postgresql: - auto-deploy deploy| tee deploy.log || true - grep -q "Detected an existing PostgreSQL database" deploy.log || exit 1 test-auto-database-url-remains-after-initial-deploy: extends: test-deploy-postgres-enabled script: # Create a release/deployment - auto-deploy download_chart - auto-deploy deploy - old=$(auto-deploy auto_database_url) # Simulate POSTGRES_ENABLED default change - unset POSTGRES_ENABLED - new=$(auto-deploy auto_database_url) - | if [[ "$old" != "$new" ]]; then echo "Database URL should not change" exit 1 fi test-auto-database-url-empty-when-disabled: extends: test-deploy-postgres-enabled script: # Create a release/deployment - auto-deploy download_chart - auto-deploy deploy # Disable postgres for new deployments - export POSTGRES_ENABLED=false - url=$(auto-deploy auto_database_url) - | if [[ -n "$url" ]]; then echo "Database URL should not be set" exit 1 fi test-deploy-canary: extends: test-deploy script: Loading src/bin/auto-deploy +10 −4 Original line number Diff line number Diff line Loading @@ -153,10 +153,16 @@ function persist_environment_url() { echo $CI_ENVIRONMENT_URL >environment_url.txt } function check_release_created() { [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$1$" --failed --pending --deployed)" ]] } function auto_database_url() { local auto_database_url if [[ "$POSTGRES_ENABLED" == "true" ]]; then auto_database_url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRESQL_RELEASE_NAME}:5432/${POSTGRES_DB}" local name="$POSTGRESQL_RELEASE_NAME" if [[ "$POSTGRES_ENABLED" == "true" ]] || ([[ "$POSTGRES_ENABLED" != "false" ]] && check_release_created "$name"); then auto_database_url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${name}:5432/${POSTGRES_DB}" fi echo "${DATABASE_URL-$auto_database_url}" Loading Loading @@ -428,7 +434,7 @@ function scale() { function delete_postgresql() { local name="$POSTGRESQL_RELEASE_NAME" if [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$name$" --failed --pending --deployed)" ]]; then if check_release_created "$name"; then helm delete "$name" --namespace "$KUBE_NAMESPACE" kubectl delete pvc -n "$KUBE_NAMESPACE" -l "release=$POSTGRESQL_RELEASE_NAME" fi Loading @@ -440,7 +446,7 @@ function delete() { local name name=$(deploy_name "$track") if [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$name$" --failed --pending --deployed)" ]]; then if check_release_created "$name"; then helm delete "$name" --namespace "$KUBE_NAMESPACE" fi Loading Loading
.gitlab/ci/test.gitlab-ci.yml +31 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,37 @@ test-show-warning-for-legacy-in-cluster-postgresql: - auto-deploy deploy| tee deploy.log || true - grep -q "Detected an existing PostgreSQL database" deploy.log || exit 1 test-auto-database-url-remains-after-initial-deploy: extends: test-deploy-postgres-enabled script: # Create a release/deployment - auto-deploy download_chart - auto-deploy deploy - old=$(auto-deploy auto_database_url) # Simulate POSTGRES_ENABLED default change - unset POSTGRES_ENABLED - new=$(auto-deploy auto_database_url) - | if [[ "$old" != "$new" ]]; then echo "Database URL should not change" exit 1 fi test-auto-database-url-empty-when-disabled: extends: test-deploy-postgres-enabled script: # Create a release/deployment - auto-deploy download_chart - auto-deploy deploy # Disable postgres for new deployments - export POSTGRES_ENABLED=false - url=$(auto-deploy auto_database_url) - | if [[ -n "$url" ]]; then echo "Database URL should not be set" exit 1 fi test-deploy-canary: extends: test-deploy script: Loading
src/bin/auto-deploy +10 −4 Original line number Diff line number Diff line Loading @@ -153,10 +153,16 @@ function persist_environment_url() { echo $CI_ENVIRONMENT_URL >environment_url.txt } function check_release_created() { [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$1$" --failed --pending --deployed)" ]] } function auto_database_url() { local auto_database_url if [[ "$POSTGRES_ENABLED" == "true" ]]; then auto_database_url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRESQL_RELEASE_NAME}:5432/${POSTGRES_DB}" local name="$POSTGRESQL_RELEASE_NAME" if [[ "$POSTGRES_ENABLED" == "true" ]] || ([[ "$POSTGRES_ENABLED" != "false" ]] && check_release_created "$name"); then auto_database_url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${name}:5432/${POSTGRES_DB}" fi echo "${DATABASE_URL-$auto_database_url}" Loading Loading @@ -428,7 +434,7 @@ function scale() { function delete_postgresql() { local name="$POSTGRESQL_RELEASE_NAME" if [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$name$" --failed --pending --deployed)" ]]; then if check_release_created "$name"; then helm delete "$name" --namespace "$KUBE_NAMESPACE" kubectl delete pvc -n "$KUBE_NAMESPACE" -l "release=$POSTGRESQL_RELEASE_NAME" fi Loading @@ -440,7 +446,7 @@ function delete() { local name name=$(deploy_name "$track") if [[ -n "$(helm ls --namespace "$KUBE_NAMESPACE" -q -f "^$name$" --failed --pending --deployed)" ]]; then if check_release_created "$name"; then helm delete "$name" --namespace "$KUBE_NAMESPACE" fi Loading