diff --git a/templates/gitlab-ci-helm.yml b/templates/gitlab-ci-helm.yml index 17b49540c3c876a20885022bfc7150e7c9cd4f1e..0279aef2b8a8dbc48b61a1e5dc510226c4da8cb7 100644 --- a/templates/gitlab-ci-helm.yml +++ b/templates/gitlab-ci-helm.yml @@ -1,16 +1,16 @@ # ========================================================================================= # Copyright (C) 2021 Orange & contributors # -# This program is free software; you can redistribute it and/or modify it under the terms -# of the GNU Lesser General Public License as published by the Free Software Foundation; +# This program is free software; you can redistribute it and/or modify it under the terms +# of the GNU Lesser General Public License as published by the Free Software Foundation; # either version 3 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public License along with this -# program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth +# You should have received a copy of the GNU Lesser General Public License along with this +# program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth # Floor, Boston, MA 02110-1301, USA. # ========================================================================================= # default workflow rules: Merge Request pipelines @@ -115,6 +115,7 @@ variables: stages: - test - package-build + - package-test - deploy - publish - production @@ -189,8 +190,8 @@ stages: _test_op=$(echo "$_fields" | cut -d: -f5) case "$_test_op" in defined) - if [[ -z "$_not" ]] && [[ -z "$_cond_val" ]]; then continue; - elif [[ "$_not" ]] && [[ "$_cond_val" ]]; then continue; + if [[ -z "$_not" ]] && [[ -z "$_cond_val" ]]; then continue; + elif [[ "$_not" ]] && [[ "$_cond_val" ]]; then continue; fi ;; equals|startswith|endswith|contains|in|equals_ic|startswith_ic|endswith_ic|contains_ic|in_ic) @@ -209,28 +210,28 @@ stages: fi case "$_test_op" in equals*) - if [[ -z "$_not" ]] && [[ "$_cond_val" != "$_cmp_val" ]]; then continue; - elif [[ "$_not" ]] && [[ "$_cond_val" == "$_cmp_val" ]]; then continue; + if [[ -z "$_not" ]] && [[ "$_cond_val" != "$_cmp_val" ]]; then continue; + elif [[ "$_not" ]] && [[ "$_cond_val" == "$_cmp_val" ]]; then continue; fi ;; startswith*) - if [[ -z "$_not" ]] && [[ "$_cond_val" != "$_cmp_val"* ]]; then continue; - elif [[ "$_not" ]] && [[ "$_cond_val" == "$_cmp_val"* ]]; then continue; + if [[ -z "$_not" ]] && [[ "$_cond_val" != "$_cmp_val"* ]]; then continue; + elif [[ "$_not" ]] && [[ "$_cond_val" == "$_cmp_val"* ]]; then continue; fi ;; endswith*) - if [[ -z "$_not" ]] && [[ "$_cond_val" != *"$_cmp_val" ]]; then continue; - elif [[ "$_not" ]] && [[ "$_cond_val" == *"$_cmp_val" ]]; then continue; + if [[ -z "$_not" ]] && [[ "$_cond_val" != *"$_cmp_val" ]]; then continue; + elif [[ "$_not" ]] && [[ "$_cond_val" == *"$_cmp_val" ]]; then continue; fi ;; contains*) - if [[ -z "$_not" ]] && [[ "$_cond_val" != *"$_cmp_val"* ]]; then continue; - elif [[ "$_not" ]] && [[ "$_cond_val" == *"$_cmp_val"* ]]; then continue; + if [[ -z "$_not" ]] && [[ "$_cond_val" != *"$_cmp_val"* ]]; then continue; + elif [[ "$_not" ]] && [[ "$_cond_val" == *"$_cmp_val"* ]]; then continue; fi ;; in*) - if [[ -z "$_not" ]] && [[ "__${_cmp_val}__" != *"__${_cond_val}__"* ]]; then continue; - elif [[ "$_not" ]] && [[ "__${_cmp_val}__" == *"__${_cond_val}__"* ]]; then continue; + if [[ -z "$_not" ]] && [[ "__${_cmp_val}__" != *"__${_cond_val}__"* ]]; then continue; + elif [[ "$_not" ]] && [[ "__${_cmp_val}__" == *"__${_cond_val}__"* ]]; then continue; fi ;; esac @@ -319,7 +320,7 @@ stages: eval_secret "$var" done } - + function get_helm_config_opt() { echo -n "--registry-config $CI_PROJECT_DIR/.config/helm/registry.json " echo -n "--repository-cache $CI_PROJECT_DIR/.cache/helm/repository " @@ -474,7 +475,7 @@ stages: # shellcheck disable=SC2086 helm ${TRACE+--debug} $helm_opts $helm_namespace_opt $HELM_TEST_ARGS $appname } - + function maybe_install_curl() { if ! command -v curl > /dev/null then @@ -518,7 +519,7 @@ stages: image: name: $HELM_KUBE_SCORE_IMAGE entrypoint: [""] - stage: test + stage: package-test before_script: - *helm-scripts - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" @@ -707,7 +708,7 @@ helm-package: helm_version_opts="--app-version ${SEMREL_INFO_NEXT_VERSION} --version ${SEMREL_INFO_NEXT_VERSION}" fi - helm $HELM_PACKAGE_ARGS ${TRACE+--debug} $helm_version_opts $HELM_CHART_DIR --destination helm_packages - - | + - | package=$(ls -1 ./helm_packages/*.tgz 2>/dev/null || echo "") if [ -n "$HELM_PUBLISH_SNAPSHOT_URL" ] && [ -n "${package}" ] then @@ -739,7 +740,7 @@ helm-publish: extends: .helm-base stage: publish script: - - | + - | package=$(ls -1 ./helm_packages/*.tgz 2>/dev/null || echo "") if [ -n "$HELM_PUBLISH_URL" ] && [ -n "${package}" ] then