Loading .gitlab-ci.yml +7 −5 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ test-shellcheck: stage: test image: koalaman/shellcheck-alpine:stable script: - shellcheck src/bin/auto-deploy - shellcheck src/bin/auto-deploy test/verify-deployment-database test-shfmt: stage: test Loading Loading @@ -211,9 +211,8 @@ test-persist-environment-url: test-deploy: <<: *test-job variables: &deploy-variables GIT_STRATEGY: none CI_APPLICATION_REPOSITORY: "registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master/test-dockerfile" CI_APPLICATION_TAG: "b359d01bc8c611a2f7b14283cc878dea4a5f85d7" CI_APPLICATION_REPOSITORY: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/auto-build-image-with-psql" CI_APPLICATION_TAG: "5d248f6fa69a" CI_ENVIRONMENT_SLUG: production CI_ENVIRONMENT_URL: example.com CI_PROJECT_PATH_SLUG: "gitlab-org/cluster-integration/auto-build-image" Loading @@ -226,11 +225,14 @@ test-deploy: POSTGRES_ENABLED: "true" POSTGRES_DB: $CI_ENVIRONMENT_SLUG POSTGRES_VERSION: 9.6.2 HELM_HOST: "localhost:44134" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm ls --host "localhost:44134" - helm get production - helm get values production --output json | grep "postgres://user:testing-password@production-postgres:5432/production" - ./test/verify-deployment-database production production-postgres test-deploy-modsecurity: extends: test-deploy Loading test/verify-deployment-database 0 → 100755 +20 −0 Original line number Diff line number Diff line #!/bin/bash -e appLabel=$1 dbLabel=$2 pod_name=$(kubectl get pod -l "app=$appLabel" -n "$KUBE_NAMESPACE" -o custom-columns=:metadata.name --no-headers) # Wait for DB pod to be ready count=0 while [[ $(kubectl get pods -l "app=$dbLabel" -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]] do [[ $count -lt 30 ]] || exit 1 echo "waiting for pod" && sleep 1 count=$((count + 1)) done # SC2016 does not apply to the quote for command pass to sh -c # shellcheck disable=SC2016 kubectl exec -i -n "$KUBE_NAMESPACE" "$pod_name" -- sh -c 'psql $DATABASE_URL -c "SELECT 1;"' Loading
.gitlab-ci.yml +7 −5 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ test-shellcheck: stage: test image: koalaman/shellcheck-alpine:stable script: - shellcheck src/bin/auto-deploy - shellcheck src/bin/auto-deploy test/verify-deployment-database test-shfmt: stage: test Loading Loading @@ -211,9 +211,8 @@ test-persist-environment-url: test-deploy: <<: *test-job variables: &deploy-variables GIT_STRATEGY: none CI_APPLICATION_REPOSITORY: "registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master/test-dockerfile" CI_APPLICATION_TAG: "b359d01bc8c611a2f7b14283cc878dea4a5f85d7" CI_APPLICATION_REPOSITORY: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/auto-build-image-with-psql" CI_APPLICATION_TAG: "5d248f6fa69a" CI_ENVIRONMENT_SLUG: production CI_ENVIRONMENT_URL: example.com CI_PROJECT_PATH_SLUG: "gitlab-org/cluster-integration/auto-build-image" Loading @@ -226,11 +225,14 @@ test-deploy: POSTGRES_ENABLED: "true" POSTGRES_DB: $CI_ENVIRONMENT_SLUG POSTGRES_VERSION: 9.6.2 HELM_HOST: "localhost:44134" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm ls --host "localhost:44134" - helm get production - helm get values production --output json | grep "postgres://user:testing-password@production-postgres:5432/production" - ./test/verify-deployment-database production production-postgres test-deploy-modsecurity: extends: test-deploy Loading
test/verify-deployment-database 0 → 100755 +20 −0 Original line number Diff line number Diff line #!/bin/bash -e appLabel=$1 dbLabel=$2 pod_name=$(kubectl get pod -l "app=$appLabel" -n "$KUBE_NAMESPACE" -o custom-columns=:metadata.name --no-headers) # Wait for DB pod to be ready count=0 while [[ $(kubectl get pods -l "app=$dbLabel" -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]] do [[ $count -lt 30 ]] || exit 1 echo "waiting for pod" && sleep 1 count=$((count + 1)) done # SC2016 does not apply to the quote for command pass to sh -c # shellcheck disable=SC2016 kubectl exec -i -n "$KUBE_NAMESPACE" "$pod_name" -- sh -c 'psql $DATABASE_URL -c "SELECT 1;"'