From 203fe7ad473ee80530123990ad6b1ee888986608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Sat, 19 Mar 2022 12:49:40 +0100 Subject: [PATCH 1/3] remove duplicate airshipper ci jobs. Introduce weekly build. This requires the veloren schedule to contain variables and requires the airshipper server to handle those in the config --- .gitlab/CI/build.gitlab-ci.yml | 32 ----------- .gitlab/CI/publish.gitlab-ci.yml | 48 ++++++---------- .gitlab/CI/release.yml | 20 ++----- .gitlab/scripts/util.sh | 97 ++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 78 deletions(-) create mode 100755 .gitlab/scripts/util.sh diff --git a/.gitlab/CI/build.gitlab-ci.yml b/.gitlab/CI/build.gitlab-ci.yml index 2425fbfdd8..c06ab55101 100644 --- a/.gitlab/CI/build.gitlab-ci.yml +++ b/.gitlab/CI/build.gitlab-ci.yml @@ -194,38 +194,6 @@ macos-aarch64: - .release tags: ["veloren/veloren:macos", "build", "publish", "trusted"] -# The air-* builds are the builds that Airshipper Server expects to find in the scheduled build webhook JSON. -# Renaming these will break Airshipper downloads! build on schedule quickfix till airshipper 0.5 -air-linux-x86_64: - extends: - - .tlinux-x86_64 - - .release-scheduled - tags: ["veloren/veloren", "build", "publish", "trusted"] - -air-linux-aarch64: - extends: - - .tlinux-aarch64 - - .release-scheduled - tags: ["veloren/veloren", "build", "publish", "trusted"] - -air-windows-x86_64: - extends: - - .twindows-x86_64 - - .release-scheduled - tags: ["veloren/veloren", "build", "publish", "trusted"] - -air-macos-x86_64: - extends: - - .tmacos-x86_64 - - .release-scheduled - tags: ["veloren/veloren:macos", "build", "publish", "trusted"] - -air-macos-aarch64: - extends: - - .tmacos-aarch64 - - .release-scheduled - tags: ["veloren/veloren:macos", "build", "publish", "trusted"] - # if NOT release or master, allow optional builds opt-linux-x86_64: extends: diff --git a/.gitlab/CI/publish.gitlab-ci.yml b/.gitlab/CI/publish.gitlab-ci.yml index 7c4b18c1c0..212063a953 100644 --- a/.gitlab/CI/publish.gitlab-ci.yml +++ b/.gitlab/CI/publish.gitlab-ci.yml @@ -3,16 +3,15 @@ .publish: stage: publish rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" - when: on_success - - when: never - -.publish-nightly: - stage: publish - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: on_success - when: never + before_script: + - source "$CI_PROJECT_DIR/.gitlab/scripts/utils.sh" + - publishtype PUBLISH_TYPE + - publishdockertag PUBLISH_DOCKER_TAG + - publishgittag PUBLISH_GIT_TAG + - echo "Publish detected '$PUBLISH_TYPE' Docker Tag '$PUBLISH_DOCKER_TAG' Git Tag '$PUBLISH_GIT_TAG'" docker: extends: .publish @@ -29,27 +28,13 @@ docker: # avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542 - export container=docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${CI_COMMIT_REF_NAME}" + - | + if [[ ! -z "${PUBLISH_DOCKER_TAG}" ]]; then + /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${PUBLISH_DOCKER_TAG}" + fi -docker-nightly: - extends: .publish-nightly - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - tags: ["veloren/veloren", "publish", "trusted"] - dependencies: - - air-linux-x86_64 - before_script: - - ls "$CI_PROJECT_DIR/server-cli/" - script: - # Help kaniko identify that it is running in a container. - # avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542 - - export container=docker - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:nightly" - -tag-nightly: - extends: .publish-nightly +gittag: + extends: .publish image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG} tags: ["veloren/veloren", "publish", "trusted"] script: @@ -57,8 +42,11 @@ tag-nightly: - git config --global user.name "veloren-bot" - git config --global http.postBuffer 52428800 - git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8} - - git tag -a "nightly" -m '' -f - - git push origin nightly -f + - | + if [[ ! -z "${PUBLISH_GIT_TAG}" ]]; then + git tag -a "${PUBLISH_GIT_TAG}" -m '' -f; + git push origin "${PUBLISH_GIT_TAG}" -f; + fi pages: extends: .publish diff --git a/.gitlab/CI/release.yml b/.gitlab/CI/release.yml index d9158b0ade..f1b91ccaa5 100644 --- a/.gitlab/CI/release.yml +++ b/.gitlab/CI/release.yml @@ -2,29 +2,17 @@ .optional-release: stage: check rules: - - if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/ + - if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ when: never - when: manual allow_failure: true -# Template to only run if pushes to master, a version tag, or release branch happened +# Template to only run if pushes to master, schedule or a version tag .release: stage: build rules: - - if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_PIPELINE_SOURCE != "schedule" && ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/) + - if: $CI_PIPELINE_SOURCE != "merge_request_event" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/) when: on_success - when: never retry: - max: 1 - -# Template to only run if pushes to master or a tag happened for scheduled builds -# This is a temporary fix until Airshipper can use a different mechanism of identifying jobs it should take -# artifacts from. Once this is done the air-* jobs can be removed. -.release-scheduled: - stage: build-nightly - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" && ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/) - when: on_success - - when: never - retry: - max: 1 + max: 1 \ No newline at end of file diff --git a/.gitlab/scripts/util.sh b/.gitlab/scripts/util.sh new file mode 100755 index 0000000000..28f9a54d0a --- /dev/null +++ b/.gitlab/scripts/util.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +### forbid setting SCHEDULE_CADENCE to v0.1.2 syntax +sanitize () { +local -n VAR=$1 +INPUT=$2 +if [[ "${INPUT}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + echo "---WARN---SANITIZE---ACTIVE---" + VAR=""; + return 1; +fi +VAR="${INPUT}"; +} + +### returns the respective type of publish for the ci +### 0 => optional build/no publish +### 10 => master build +### 20 => scheduled build +### 30 => release build +publishtype () { +local -n VAR=$1 +if [[ "${CI_COMMIT_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + VAR=30; + return 0; +fi +if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then + VAR=20; + return 0; +fi +if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then + VAR=10; + return 0; +fi +VAR=0; +} + +### returns respective DOCKER TAG +### 0 => exit code 3 +### 10 => master +### 20 => +### 30 => +### else => exit code 7 + +publishdockertag () { +local -n VAR=$1 +INPUT=$2 +if [[ "${INPUT}" == "0" ]]; then + VAR=""; + return 3; +fi +if [[ "${INPUT}" == "10" ]]; then + VAR="master"; + return 0; +fi +if [[ "${INPUT}" == "20" ]]; then + VAR="${SCHEDULE_CADENCE}"; + sanitize $1 "${VAR}"; + return 0; +fi +if [[ "${INPUT}" == "30" ]]; then + VAR="${CI_COMMIT_TAG}"; + return 0; +fi +VAR=""; +return 7; +} + +### returns respective GIT TAG +### 0 => exit code 3 +### 10 => exit code 4 +### 20 => +### 30 => exit code 6 +### else => exit code 7 + +publishgittag () { +local -n VAR=$1 +INPUT=$2 +if [[ "${INPUT}" == "0" ]]; then + VAR=""; + return 3; +fi +if [[ "${INPUT}" == "10" ]]; then + VAR=""; + return 4; +fi +if [[ "${INPUT}" == "20" ]]; then + VAR="${SCHEDULE_CADENCE}"; + sanitize $1 "${VAR}"; + return 0; +fi +if [[ "${INPUT}" == "30" ]]; then + VAR="${CI_COMMIT_TAG}"; + return 0; +fi +VAR=""; +return 7; +} \ No newline at end of file From 618d4b2340547b3367597f6d592650fc523e0ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 6 Apr 2022 21:08:29 +0200 Subject: [PATCH 2/3] simply scripts alot, not the null check is necessray because gitlab ci regex with variables is weird and would contain errors otherwise. limit pages to master run only, as we dont export scheduled pages --- .gitlab-ci.yml | 1 + .gitlab/CI/check.gitlab-ci.yml | 3 +- .gitlab/CI/publish.gitlab-ci.yml | 12 ++-- .gitlab/CI/release.yml | 4 +- .gitlab/scripts/code-quality.sh | 1 + .gitlab/scripts/util.sh | 102 ++++++++----------------------- 6 files changed, 39 insertions(+), 84 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9120aac50a..f48bb18ac6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,7 @@ variables: GIT_DEPTH: 3 GIT_CLEAN_FLAGS: -f CACHE_IMAGE_TAG: d7756444 + TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/' default: # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines diff --git a/.gitlab/CI/check.gitlab-ci.yml b/.gitlab/CI/check.gitlab-ci.yml index ad23e01a9e..a8a6b100ed 100644 --- a/.gitlab/CI/check.gitlab-ci.yml +++ b/.gitlab/CI/check.gitlab-ci.yml @@ -1,10 +1,11 @@ -# cargo clippy is a superset of cargo check, so we don't check manually code-quality: extends: .recompile-branch stage: check image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG} tags: ["veloren/veloren", "check"] script: + - echo $CI_COMMIT_TAG + - echo $TAG_REGEX - ln -s /dockercache/target target - cat ./.gitlab/scripts/code-quality.sh - source ./.gitlab/scripts/code-quality.sh diff --git a/.gitlab/CI/publish.gitlab-ci.yml b/.gitlab/CI/publish.gitlab-ci.yml index 212063a953..7b64cc065b 100644 --- a/.gitlab/CI/publish.gitlab-ci.yml +++ b/.gitlab/CI/publish.gitlab-ci.yml @@ -8,10 +8,6 @@ - when: never before_script: - source "$CI_PROJECT_DIR/.gitlab/scripts/utils.sh" - - publishtype PUBLISH_TYPE - - publishdockertag PUBLISH_DOCKER_TAG - - publishgittag PUBLISH_GIT_TAG - - echo "Publish detected '$PUBLISH_TYPE' Docker Tag '$PUBLISH_DOCKER_TAG' Git Tag '$PUBLISH_GIT_TAG'" docker: extends: .publish @@ -29,7 +25,8 @@ docker: - export container=docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - | - if [[ ! -z "${PUBLISH_DOCKER_TAG}" ]]; then + publishdockertag PUBLISH_DOCKER_TAG + if [ "${PUBLISH_DOCKER_TAG}" != "" ]; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${PUBLISH_DOCKER_TAG}" fi @@ -43,13 +40,16 @@ gittag: - git config --global http.postBuffer 52428800 - git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8} - | - if [[ ! -z "${PUBLISH_GIT_TAG}" ]]; then + publishgittag PUBLISH_GIT_TAG + if [ "${PUBLISH_GIT_TAG}" != "" ]; then git tag -a "${PUBLISH_GIT_TAG}" -m '' -f; git push origin "${PUBLISH_GIT_TAG}" -f; fi pages: extends: .publish + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG} tags: ["veloren/veloren", "publish"] artifacts: diff --git a/.gitlab/CI/release.yml b/.gitlab/CI/release.yml index f1b91ccaa5..680f6c2646 100644 --- a/.gitlab/CI/release.yml +++ b/.gitlab/CI/release.yml @@ -2,7 +2,7 @@ .optional-release: stage: check rules: - - if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ + - if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || ( $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ $TAG_REGEX ) when: never - when: manual allow_failure: true @@ -11,7 +11,7 @@ .release: stage: build rules: - - if: $CI_PIPELINE_SOURCE != "merge_request_event" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/) + - if: $CI_PIPELINE_SOURCE != "merge_request_event" && ( $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || ( $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ $TAG_REGEX ) ) when: on_success - when: never retry: diff --git a/.gitlab/scripts/code-quality.sh b/.gitlab/scripts/code-quality.sh index 5e63fdffb0..60b7285084 100755 --- a/.gitlab/scripts/code-quality.sh +++ b/.gitlab/scripts/code-quality.sh @@ -1,4 +1,5 @@ #!/bin/bash +# cargo clippy is a superset of cargo check, so we don't check manually time cargo clippy --all-targets --locked --features="bin_cmd_doc_gen,bin_compression,bin_csv,bin_graphviz,bin_bot,bin_asset_migrate,asset_tweak" -- -D warnings && # Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features time cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings && diff --git a/.gitlab/scripts/util.sh b/.gitlab/scripts/util.sh index 28f9a54d0a..2ad34607cc 100755 --- a/.gitlab/scripts/util.sh +++ b/.gitlab/scripts/util.sh @@ -1,97 +1,49 @@ #!/bin/bash -### forbid setting SCHEDULE_CADENCE to v0.1.2 syntax -sanitize () { +### returns respective DOCKER TAG +### release-tag => (e.g. v1.2.3) +### schedule => (e.g. nightly) +### master => "master" +### else => "" +publishdockertag () { +# this stores the result in a variable defined by the caller local -n VAR=$1 -INPUT=$2 -if [[ "${INPUT}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then - echo "---WARN---SANITIZE---ACTIVE---" - VAR=""; - return 1; -fi -VAR="${INPUT}"; -} - -### returns the respective type of publish for the ci -### 0 => optional build/no publish -### 10 => master build -### 20 => scheduled build -### 30 => release build -publishtype () { -local -n VAR=$1 -if [[ "${CI_COMMIT_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then - VAR=30; +VAR=""; +if [[ "${CI_COMMIT_TAG}" =~ ${TAG_REGEX} ]]; then + VAR="${CI_COMMIT_TAG}"; return 0; fi if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then - VAR=20; + # sanitize check + if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then + VAR="invalid_cadence"; + else + VAR="${SCHEDULE_CADENCE}"; + fi return 0; fi if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then - VAR=10; - return 0; -fi -VAR=0; -} - -### returns respective DOCKER TAG -### 0 => exit code 3 -### 10 => master -### 20 => -### 30 => -### else => exit code 7 - -publishdockertag () { -local -n VAR=$1 -INPUT=$2 -if [[ "${INPUT}" == "0" ]]; then - VAR=""; - return 3; -fi -if [[ "${INPUT}" == "10" ]]; then VAR="master"; return 0; fi -if [[ "${INPUT}" == "20" ]]; then - VAR="${SCHEDULE_CADENCE}"; - sanitize $1 "${VAR}"; - return 0; -fi -if [[ "${INPUT}" == "30" ]]; then - VAR="${CI_COMMIT_TAG}"; - return 0; -fi -VAR=""; -return 7; } ### returns respective GIT TAG -### 0 => exit code 3 -### 10 => exit code 4 -### 20 => -### 30 => exit code 6 -### else => exit code 7 - +### release-tag => "" (releases already have a tag) +### schedule => (e.g. nightly) +### master => "" (master doesn't need a tag) +### else => "" publishgittag () { local -n VAR=$1 -INPUT=$2 -if [[ "${INPUT}" == "0" ]]; then - VAR=""; - return 3; -fi -if [[ "${INPUT}" == "10" ]]; then - VAR=""; - return 4; -fi -if [[ "${INPUT}" == "20" ]]; then +if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then VAR="${SCHEDULE_CADENCE}"; - sanitize $1 "${VAR}"; - return 0; -fi -if [[ "${INPUT}" == "30" ]]; then - VAR="${CI_COMMIT_TAG}"; + # sanitize check + if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then + VAR="invalid_cadence"; + else + VAR="${SCHEDULE_CADENCE}"; + fi return 0; fi VAR=""; -return 7; } \ No newline at end of file From 0c50d6fe245de2af29ef097ad58ebebb9d577be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Fri, 8 Apr 2022 15:15:50 +0200 Subject: [PATCH 3/3] include gittag into yaml --- .gitlab/CI/publish.gitlab-ci.yml | 9 +++++---- .gitlab/scripts/util.sh | 20 -------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/.gitlab/CI/publish.gitlab-ci.yml b/.gitlab/CI/publish.gitlab-ci.yml index 7b64cc065b..2aa2103cec 100644 --- a/.gitlab/CI/publish.gitlab-ci.yml +++ b/.gitlab/CI/publish.gitlab-ci.yml @@ -32,6 +32,8 @@ docker: gittag: extends: .publish + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG} tags: ["veloren/veloren", "publish", "trusted"] script: @@ -40,10 +42,9 @@ gittag: - git config --global http.postBuffer 52428800 - git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8} - | - publishgittag PUBLISH_GIT_TAG - if [ "${PUBLISH_GIT_TAG}" != "" ]; then - git tag -a "${PUBLISH_GIT_TAG}" -m '' -f; - git push origin "${PUBLISH_GIT_TAG}" -f; + if [[ ! "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then + git tag -a "${SCHEDULE_CADENCE}" -m '' -f; + git push origin "${SCHEDULE_CADENCE}" -f; fi pages: diff --git a/.gitlab/scripts/util.sh b/.gitlab/scripts/util.sh index 2ad34607cc..eed00b9b42 100755 --- a/.gitlab/scripts/util.sh +++ b/.gitlab/scripts/util.sh @@ -26,24 +26,4 @@ if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then VAR="master"; return 0; fi -} - -### returns respective GIT TAG -### release-tag => "" (releases already have a tag) -### schedule => (e.g. nightly) -### master => "" (master doesn't need a tag) -### else => "" -publishgittag () { -local -n VAR=$1 -if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then - VAR="${SCHEDULE_CADENCE}"; - # sanitize check - if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then - VAR="invalid_cadence"; - else - VAR="${SCHEDULE_CADENCE}"; - fi - return 0; -fi -VAR=""; } \ No newline at end of file