Loading .gitlab/ci/chart.gitlab-ci.yml +2 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ kubesec-sast: KUBESEC_HELM_OPTIONS: '-f assets/auto-deploy-app/values.yaml' before_script: - cd assets/auto-deploy-app - helm repo add stable https://kubernetes-charts.storage.googleapis.com/ - helm repo add stable https://charts.helm.sh/stable - helm dependency build . # we are using merge request pipelines, so we need to override the rules rules: Loading @@ -41,7 +41,7 @@ chart:test: - tar -C /usr/local -xzf go1.15.2.linux-amd64.tar.gz - export PATH=$PATH:/usr/local/go/bin - go version - helm repo add stable https://kubernetes-charts.storage.googleapis.com/ - helm repo add stable https://charts.helm.sh/stable - helm dependency build . - cd test && GO111MODULE=auto go test . Loading .gitlab/ci/release.gitlab-ci.yml +4 −3 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ publish-dryrun: script: - semantic-release -d |tee output.log # Check if the bundled chart version matches the next auto-deploy-image version. - git diff @..@^ --name-only | grep 'assets/auto-deploy-app' - if [[ "$?" != "0" ]]; then echo 'This change does not contain changes for the chart. Skip the validation' && exit 0; fi - next_release_version=$(cat output.log | grep -oP "The next release version is \K.*$") || true - bundled_chart_version=$(cat assets/auto-deploy-app/Chart.yaml | grep -oP "version:\s*\K.*$") - echo "next_release_version is $next_release_version" Loading @@ -60,9 +62,8 @@ publish-dryrun: - | if [ -n "${next_release_version}" ] && [ -n "${bundled_chart_version}" ] && [ "${next_release_version}" != "${bundled_chart_version}" ]; then cat <<- EOS [WARN] auto-deploy-app chart version mismatch error. This merge request triggers to create a new release, auto-deploy-image ${next_release_version}. This version must be matched to the auto-deploy-app chart's version, however, currently it's set to ${bundled_chart_version}. [WARN] auto-deploy-app chart version outdated! This merge request changes auto-deploy-app chart, however, the chart version is not updated yet. Please set ${next_release_version} to the version column in assets/auto-deploy-app/Chart.yaml to resovle this error. EOS exit 1 Loading .gitlab/ci/test.gitlab-ci.yml +66 −23 Original line number Diff line number Diff line Loading @@ -61,20 +61,6 @@ test-download-chart: - auto-deploy download_chart - ./test/verify-chart-version 2 test-download-chart-from-repo: <<: *test-job variables: AUTO_DEVOPS_CHART_REPOSITORY: https://charts.gitlab.io AUTO_DEVOPS_CHART_REPOSITORY_NAME: gitlab AUTO_DEVOPS_CHART: gitlab/auto-deploy-app script: - auto-deploy download_chart - ./test/verify-chart-version 0 # test that a custom repo gets added even if the chart/ folder is present - export AUTO_DEVOPS_CHART_REPOSITORY_NAME=custom - auto-deploy download_chart - helm fetch custom/auto-deploy-app test-deploy-name: <<: *test-job variables: Loading Loading @@ -282,6 +268,18 @@ test-deploy: - helm get values production --output json | grep "postgres://user:testing-password@production-postgresql:5432/production" - ./test/verify-deployment-database production postgresql test-deploy-postgres-disabled: extends: test-deploy variables: POSTGRES_ENABLED: "false" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm list > releases.txt - if grep -q "postgres" releases.txt; then echo "postgresql should not be installed"; exit 1; fi test-deploy-atomic: extends: test-deploy variables: Loading Loading @@ -318,6 +316,16 @@ test-deploy-debug: - auto-deploy download_chart - auto-deploy deploy test-deploy-when-stable-chart-repository-is-unreachable: extends: test-deploy variables: <<: *deploy-variables script: - echo "127.0.0.1 kubernetes-charts.storage.googleapis.com" >> /etc/hosts - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy test-deploy-postgresql-channel-1: extends: test-deploy variables: Loading @@ -330,6 +338,47 @@ test-deploy-postgresql-channel-1: - helm get values production --output json | grep "postgres://user:testing-password@production-postgres:5432/production" - ./test/verify-deployment-database production production-postgres test-deploy-postgresql-channel-1-disabled: extends: test-deploy-postgresql-channel-1 variables: POSTGRES_ENABLED: "false" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm get manifest production > manifest.txt - if grep -q "postgres-password" manifest.txt; then echo "postgresql should not be installed"; exit 1; fi test-scale-does-not-create-old-postgres: extends: test-deploy script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - auto-deploy scale - exist=$(auto-deploy check_old_postgres_exist) - | if [[ "$exist" != "false" ]]; then echo "Old Postgres should not exist" exit 1 fi test-scale-does-not-delete-old-postgres: extends: test-deploy script: - export AUTO_DEVOPS_POSTGRES_CHANNEL=1 - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - auto-deploy scale - exist=$(auto-deploy check_old_postgres_exist) - | if [[ "$exist" != "true" ]]; then echo "Old Postgres should exist" exit 1 fi test-deploy-does-not-delete-old-postgres-by-default: extends: test-deploy script: Loading Loading @@ -455,18 +504,12 @@ test-delete-canary-postgresql: test-chart-major-version-upgrade: extends: test-deploy variables: AUTO_DEVOPS_CHART_REPOSITORY: https://charts.gitlab.io AUTO_DEVOPS_CHART_REPOSITORY_NAME: gitlab script: - unset ADDITIONAL_HOSTS # The legacy chart is not compatible wildcard hosts on ADDITIONAL_HOSTS - auto-deploy initialize_tiller # Downloading legacy v0 chart from charts.gitlab.io and the deployment should succeed - AUTO_DEVOPS_CHART=gitlab/auto-deploy-app auto-deploy download_chart - auto-deploy deploy - rm -Rf chart # Copying bundled chart from local storage and the deployment should fail # Copying bundled chart from local storage and the deployment should succeed - auto-deploy download_chart - auto-deploy deploy # Modifying the chart version and the deployment should fail - "sed -i 's/version:.*/version: 10.0.0/g' chart/Chart.yaml" - cat chart/Chart.yaml - auto-deploy deploy| tee deploy.log || true Loading assets/auto-deploy-app/CONTRIBUTING.md +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ on the tests, you need to have [Helm 2](https://v2.helm.sh/docs/) and To run the tests, run the following commands from the root of your copy of `auto-deploy-app`: ```shell helm repo add stable https://kubernetes-charts.storage.googleapis.com/ # required only once helm repo add stable https://charts.helm.sh/stable # required only once helm dependency build . # required any time the dependencies change cd test GO111MODULE=auto go test . # required for every change to the tests or the template Loading assets/auto-deploy-app/Chart.yaml +1 −1 Original line number Diff line number Diff line apiVersion: v1 description: GitLab's Auto-deploy Helm Chart name: auto-deploy-app version: 2.0.0-beta.3 version: 2.0.0 icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.png Loading
.gitlab/ci/chart.gitlab-ci.yml +2 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ kubesec-sast: KUBESEC_HELM_OPTIONS: '-f assets/auto-deploy-app/values.yaml' before_script: - cd assets/auto-deploy-app - helm repo add stable https://kubernetes-charts.storage.googleapis.com/ - helm repo add stable https://charts.helm.sh/stable - helm dependency build . # we are using merge request pipelines, so we need to override the rules rules: Loading @@ -41,7 +41,7 @@ chart:test: - tar -C /usr/local -xzf go1.15.2.linux-amd64.tar.gz - export PATH=$PATH:/usr/local/go/bin - go version - helm repo add stable https://kubernetes-charts.storage.googleapis.com/ - helm repo add stable https://charts.helm.sh/stable - helm dependency build . - cd test && GO111MODULE=auto go test . Loading
.gitlab/ci/release.gitlab-ci.yml +4 −3 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ publish-dryrun: script: - semantic-release -d |tee output.log # Check if the bundled chart version matches the next auto-deploy-image version. - git diff @..@^ --name-only | grep 'assets/auto-deploy-app' - if [[ "$?" != "0" ]]; then echo 'This change does not contain changes for the chart. Skip the validation' && exit 0; fi - next_release_version=$(cat output.log | grep -oP "The next release version is \K.*$") || true - bundled_chart_version=$(cat assets/auto-deploy-app/Chart.yaml | grep -oP "version:\s*\K.*$") - echo "next_release_version is $next_release_version" Loading @@ -60,9 +62,8 @@ publish-dryrun: - | if [ -n "${next_release_version}" ] && [ -n "${bundled_chart_version}" ] && [ "${next_release_version}" != "${bundled_chart_version}" ]; then cat <<- EOS [WARN] auto-deploy-app chart version mismatch error. This merge request triggers to create a new release, auto-deploy-image ${next_release_version}. This version must be matched to the auto-deploy-app chart's version, however, currently it's set to ${bundled_chart_version}. [WARN] auto-deploy-app chart version outdated! This merge request changes auto-deploy-app chart, however, the chart version is not updated yet. Please set ${next_release_version} to the version column in assets/auto-deploy-app/Chart.yaml to resovle this error. EOS exit 1 Loading
.gitlab/ci/test.gitlab-ci.yml +66 −23 Original line number Diff line number Diff line Loading @@ -61,20 +61,6 @@ test-download-chart: - auto-deploy download_chart - ./test/verify-chart-version 2 test-download-chart-from-repo: <<: *test-job variables: AUTO_DEVOPS_CHART_REPOSITORY: https://charts.gitlab.io AUTO_DEVOPS_CHART_REPOSITORY_NAME: gitlab AUTO_DEVOPS_CHART: gitlab/auto-deploy-app script: - auto-deploy download_chart - ./test/verify-chart-version 0 # test that a custom repo gets added even if the chart/ folder is present - export AUTO_DEVOPS_CHART_REPOSITORY_NAME=custom - auto-deploy download_chart - helm fetch custom/auto-deploy-app test-deploy-name: <<: *test-job variables: Loading Loading @@ -282,6 +268,18 @@ test-deploy: - helm get values production --output json | grep "postgres://user:testing-password@production-postgresql:5432/production" - ./test/verify-deployment-database production postgresql test-deploy-postgres-disabled: extends: test-deploy variables: POSTGRES_ENABLED: "false" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm list > releases.txt - if grep -q "postgres" releases.txt; then echo "postgresql should not be installed"; exit 1; fi test-deploy-atomic: extends: test-deploy variables: Loading Loading @@ -318,6 +316,16 @@ test-deploy-debug: - auto-deploy download_chart - auto-deploy deploy test-deploy-when-stable-chart-repository-is-unreachable: extends: test-deploy variables: <<: *deploy-variables script: - echo "127.0.0.1 kubernetes-charts.storage.googleapis.com" >> /etc/hosts - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy test-deploy-postgresql-channel-1: extends: test-deploy variables: Loading @@ -330,6 +338,47 @@ test-deploy-postgresql-channel-1: - helm get values production --output json | grep "postgres://user:testing-password@production-postgres:5432/production" - ./test/verify-deployment-database production production-postgres test-deploy-postgresql-channel-1-disabled: extends: test-deploy-postgresql-channel-1 variables: POSTGRES_ENABLED: "false" script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - helm get production - helm get manifest production > manifest.txt - if grep -q "postgres-password" manifest.txt; then echo "postgresql should not be installed"; exit 1; fi test-scale-does-not-create-old-postgres: extends: test-deploy script: - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - auto-deploy scale - exist=$(auto-deploy check_old_postgres_exist) - | if [[ "$exist" != "false" ]]; then echo "Old Postgres should not exist" exit 1 fi test-scale-does-not-delete-old-postgres: extends: test-deploy script: - export AUTO_DEVOPS_POSTGRES_CHANNEL=1 - auto-deploy initialize_tiller - auto-deploy download_chart - auto-deploy deploy - auto-deploy scale - exist=$(auto-deploy check_old_postgres_exist) - | if [[ "$exist" != "true" ]]; then echo "Old Postgres should exist" exit 1 fi test-deploy-does-not-delete-old-postgres-by-default: extends: test-deploy script: Loading Loading @@ -455,18 +504,12 @@ test-delete-canary-postgresql: test-chart-major-version-upgrade: extends: test-deploy variables: AUTO_DEVOPS_CHART_REPOSITORY: https://charts.gitlab.io AUTO_DEVOPS_CHART_REPOSITORY_NAME: gitlab script: - unset ADDITIONAL_HOSTS # The legacy chart is not compatible wildcard hosts on ADDITIONAL_HOSTS - auto-deploy initialize_tiller # Downloading legacy v0 chart from charts.gitlab.io and the deployment should succeed - AUTO_DEVOPS_CHART=gitlab/auto-deploy-app auto-deploy download_chart - auto-deploy deploy - rm -Rf chart # Copying bundled chart from local storage and the deployment should fail # Copying bundled chart from local storage and the deployment should succeed - auto-deploy download_chart - auto-deploy deploy # Modifying the chart version and the deployment should fail - "sed -i 's/version:.*/version: 10.0.0/g' chart/Chart.yaml" - cat chart/Chart.yaml - auto-deploy deploy| tee deploy.log || true Loading
assets/auto-deploy-app/CONTRIBUTING.md +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ on the tests, you need to have [Helm 2](https://v2.helm.sh/docs/) and To run the tests, run the following commands from the root of your copy of `auto-deploy-app`: ```shell helm repo add stable https://kubernetes-charts.storage.googleapis.com/ # required only once helm repo add stable https://charts.helm.sh/stable # required only once helm dependency build . # required any time the dependencies change cd test GO111MODULE=auto go test . # required for every change to the tests or the template Loading
assets/auto-deploy-app/Chart.yaml +1 −1 Original line number Diff line number Diff line apiVersion: v1 description: GitLab's Auto-deploy Helm Chart name: auto-deploy-app version: 2.0.0-beta.3 version: 2.0.0 icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.png