From ecadc9421c3b73733a6c233a1d606bfade4179e7 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Wed, 11 Oct 2023 07:16:20 -0600 Subject: [PATCH 1/4] add custom test values file --- test-values/ci-custom-values.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test-values/ci-custom-values.yaml diff --git a/test-values/ci-custom-values.yaml b/test-values/ci-custom-values.yaml new file mode 100644 index 0000000000..e69de29bb2 -- GitLab From 17bffa7fcda70c6cce255a3848d82a87ae663725 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Wed, 11 Oct 2023 07:33:22 -0600 Subject: [PATCH 2/4] add detection of existing values file for the feature --- scripts/ci/autodevops.sh | 6 ++++++ test-values/ci-custom-values.yaml | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/scripts/ci/autodevops.sh b/scripts/ci/autodevops.sh index a50bde0b96..7c3f9ab958 100644 --- a/scripts/ci/autodevops.sh +++ b/scripts/ci/autodevops.sh @@ -154,6 +154,11 @@ CIYAML SENTRY_CONFIGURATION="-f ci.sentry.yaml" fi + FEATURE_VALUES="" + + if [ -r "${CI_COMMIT_REF_NAME}" ]; then + FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}" + fi helm upgrade --install \ $WAIT \ @@ -177,6 +182,7 @@ CIYAML --set global.extraEnv.GITLAB_LICENSE_MODE="test" \ --set global.extraEnv.CUSTOMER_PORTAL_URL="https://customers.staging.gitlab.com" \ --set global.gitlab.license.secret="$RELEASE_NAME-gitlab-license" \ + ${FEATURE_VALUES} \ --namespace="$NAMESPACE" \ "${gitlab_version_args[@]}" \ --version="$CI_PIPELINE_ID-$CI_JOB_ID" \ diff --git a/test-values/ci-custom-values.yaml b/test-values/ci-custom-values.yaml index e69de29bb2..e2cb3250ab 100644 --- a/test-values/ci-custom-values.yaml +++ b/test-values/ci-custom-values.yaml @@ -0,0 +1,11 @@ +global: + ## Global Service Annotations and Labels + service: + annotations: + sample/change: "changed-service" + + + ## Global Deployment Annotations + deployment: + annotations: + sample/change: "changed-deployment" -- GitLab From 157ec85cafe51a51b07951a847d9a574a77cbf21 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Wed, 11 Oct 2023 07:52:18 -0600 Subject: [PATCH 3/4] perform validation using feature values --- .gitlab-ci.yml | 6 ++++++ scripts/ci/autodevops.sh | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 016e0ac0b9..7d0d17c452 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -198,9 +198,15 @@ lint_package: - echo "$HELM_DEFAULT_SETTINGS" | tee ./template_settings.yaml - echo "$HELM_SETTINGS" | tee -a ./template_settings.yaml - echo "${KUBECONFORM_SCHEMA_LOCATION:-default}" + - FEATURE_VALUES="" + - | + if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ]; then + FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}.yaml" + fi - > helm kubeconform --strict --summary -f ./template_settings.yaml + ${FEATURE_VALUES} --kubernetes-version $KUBE_VERSION --schema-location "${KUBECONFORM_SCHEMA_LOCATION:-default}" --schema-location "$KUBE_CRD_SCHEMA_URL" diff --git a/scripts/ci/autodevops.sh b/scripts/ci/autodevops.sh index 7c3f9ab958..75f047c9a6 100644 --- a/scripts/ci/autodevops.sh +++ b/scripts/ci/autodevops.sh @@ -156,8 +156,8 @@ CIYAML fi FEATURE_VALUES="" - if [ -r "${CI_COMMIT_REF_NAME}" ]; then - FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}" + if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ]; then + FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}.yaml" fi helm upgrade --install \ -- GitLab From 3ccf52b050baa3f10599c132fce4743500d371f4 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Thu, 12 Oct 2023 07:21:00 -0600 Subject: [PATCH 4/4] Add additional control over default values.yaml use --- .gitlab-ci.yml | 2 +- scripts/ci/autodevops.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d0d17c452..9bf2004ea5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -200,7 +200,7 @@ lint_package: - echo "${KUBECONFORM_SCHEMA_LOCATION:-default}" - FEATURE_VALUES="" - | - if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ]; then + if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ] && [ "${USE_DEFAULT_VALUES}" != "true" ]; then FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}.yaml" fi - > diff --git a/scripts/ci/autodevops.sh b/scripts/ci/autodevops.sh index 75f047c9a6..867098699c 100644 --- a/scripts/ci/autodevops.sh +++ b/scripts/ci/autodevops.sh @@ -156,7 +156,7 @@ CIYAML fi FEATURE_VALUES="" - if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ]; then + if [ -r "test-values/${CI_COMMIT_REF_NAME}.yaml" ] && [ "${USE_DEFAULT_VALUES}" != "true" ]; then FEATURE_VALUES="-f test-values/${CI_COMMIT_REF_NAME}.yaml" fi -- GitLab