Loading .gitlab/ci/test.gitlab-ci.yml +21 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,27 @@ test-deploy-deletes-old-postgres-if-opt-in: # test that the new postgres is up - ./test/verify-deployment-database production postgresql test-deploy-k8s-1.16: extends: test-deploy services: - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.16.7-k3s1 alias: k3s variables: AUTO_DEVOPS_POSTGRES_CHANNEL: 2 POSTGRES_VERSION: 9.6.16 before_script: - curl k3s:8081?service=k3s > k3s.yaml - export KUBECONFIG=$(pwd)/k3s.yaml - kubectl version - kubectl cluster-info script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm get values production --output json | grep "postgres://user:testing-password@production-postgresql:5432/production" - ./test/verify-deployment-database production postgresql test-deploy-canary: extends: test-deploy script: Loading src/bin/auto-deploy +10 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ export HELM_HOST="localhost:44134" export RELEASE_NAME=${HELM_RELEASE_NAME:-$CI_ENVIRONMENT_SLUG} export POSTGRESQL_RELEASE_NAME="${RELEASE_NAME}-postgresql" export AUTO_DEVOPS_POSTGRES_CHANNEL=${AUTO_DEVOPS_POSTGRES_CHANNEL:-"1"} export AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE=/tmp/auto-deploy-environment-values.yaml function check_kube_domain() { if [[ -z "$KUBE_INGRESS_BASE_DOMAIN" ]]; then Loading Loading @@ -67,6 +68,10 @@ function initialize_tiller() { echo "" } function write_environment_values_file() { echo "deploymentApiVersion: apps/v1" >"$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" } function create_secret() { echo "Create secret..." if [[ "$CI_PROJECT_VISIBILITY" == "public" ]]; then Loading Loading @@ -220,6 +225,9 @@ function deploy() { atomic_flag=('--atomic') fi # TODO: Over time, migrate all --set values to this file, see https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/issues/31 write_environment_values_file if [[ -n "$DB_INITIALIZE" && -z "$(helm ls -q "^$stable_name$")" ]]; then echo "Initializing service URL and database. No deployment will be created" # shellcheck disable=SC2086 # HELM_UPGRADE_EXTRA_ARGS -- double quote variables to prevent globbing Loading Loading @@ -252,6 +260,7 @@ function deploy() { --set postgresql.imageTag="$POSTGRES_VERSION" \ --set application.initializeCommand="$DB_INITIALIZE" \ "${modsecurity_set_args[@]}" \ --values "$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" \ "${helm_values_args[@]}" \ $HELM_UPGRADE_EXTRA_ARGS \ --namespace="$KUBE_NAMESPACE" \ Loading Loading @@ -291,6 +300,7 @@ function deploy() { --set application.initializeCommand="" \ --set application.migrateCommand="$DB_MIGRATE" \ "${modsecurity_set_args[@]}" \ --values "$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" \ "${helm_values_args[@]}" \ $HELM_UPGRADE_EXTRA_ARGS \ --namespace="$KUBE_NAMESPACE" \ Loading Loading
.gitlab/ci/test.gitlab-ci.yml +21 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,27 @@ test-deploy-deletes-old-postgres-if-opt-in: # test that the new postgres is up - ./test/verify-deployment-database production postgresql test-deploy-k8s-1.16: extends: test-deploy services: - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.16.7-k3s1 alias: k3s variables: AUTO_DEVOPS_POSTGRES_CHANNEL: 2 POSTGRES_VERSION: 9.6.16 before_script: - curl k3s:8081?service=k3s > k3s.yaml - export KUBECONFIG=$(pwd)/k3s.yaml - kubectl version - kubectl cluster-info script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm get values production --output json | grep "postgres://user:testing-password@production-postgresql:5432/production" - ./test/verify-deployment-database production postgresql test-deploy-canary: extends: test-deploy script: Loading
src/bin/auto-deploy +10 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ export HELM_HOST="localhost:44134" export RELEASE_NAME=${HELM_RELEASE_NAME:-$CI_ENVIRONMENT_SLUG} export POSTGRESQL_RELEASE_NAME="${RELEASE_NAME}-postgresql" export AUTO_DEVOPS_POSTGRES_CHANNEL=${AUTO_DEVOPS_POSTGRES_CHANNEL:-"1"} export AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE=/tmp/auto-deploy-environment-values.yaml function check_kube_domain() { if [[ -z "$KUBE_INGRESS_BASE_DOMAIN" ]]; then Loading Loading @@ -67,6 +68,10 @@ function initialize_tiller() { echo "" } function write_environment_values_file() { echo "deploymentApiVersion: apps/v1" >"$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" } function create_secret() { echo "Create secret..." if [[ "$CI_PROJECT_VISIBILITY" == "public" ]]; then Loading Loading @@ -220,6 +225,9 @@ function deploy() { atomic_flag=('--atomic') fi # TODO: Over time, migrate all --set values to this file, see https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/issues/31 write_environment_values_file if [[ -n "$DB_INITIALIZE" && -z "$(helm ls -q "^$stable_name$")" ]]; then echo "Initializing service URL and database. No deployment will be created" # shellcheck disable=SC2086 # HELM_UPGRADE_EXTRA_ARGS -- double quote variables to prevent globbing Loading Loading @@ -252,6 +260,7 @@ function deploy() { --set postgresql.imageTag="$POSTGRES_VERSION" \ --set application.initializeCommand="$DB_INITIALIZE" \ "${modsecurity_set_args[@]}" \ --values "$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" \ "${helm_values_args[@]}" \ $HELM_UPGRADE_EXTRA_ARGS \ --namespace="$KUBE_NAMESPACE" \ Loading Loading @@ -291,6 +300,7 @@ function deploy() { --set application.initializeCommand="" \ --set application.migrateCommand="$DB_MIGRATE" \ "${modsecurity_set_args[@]}" \ --values "$AUTO_DEPLOY_ENVIRONMENT_VALUES_FILE" \ "${helm_values_args[@]}" \ $HELM_UPGRADE_EXTRA_ARGS \ --namespace="$KUBE_NAMESPACE" \ Loading