Merge branch 'xMAC94x/fixed_ci3' into 'master'

kaniko seems to have a different shell that doesnt support local command, just use export then

See merge request veloren/veloren!3341
This commit is contained in:
Marcel 2022-04-25 06:21:25 +00:00
commit ff34891665
2 changed files with 8 additions and 9 deletions

View File

@ -23,8 +23,8 @@ docker:
- export container=docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- |
source "$CI_PROJECT_DIR/.gitlab/scripts/util.sh"
publishdockertag PUBLISH_DOCKER_TAG
source "$CI_PROJECT_DIR/.gitlab/scripts/util.sh";
publishdockertag;
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

View File

@ -6,24 +6,23 @@
### master => "master"
### else => ""
publishdockertag () {
# this stores the result in a variable defined by the caller
local -n VAR=$1
VAR="";
# this stores the result in PUBLISH_DOCKER_TAG
export PUBLISH_DOCKER_TAG="";
if [[ "${CI_COMMIT_TAG}" =~ ${TAG_REGEX} ]]; then
VAR="${CI_COMMIT_TAG}";
export PUBLISH_DOCKER_TAG="${CI_COMMIT_TAG}";
return 0;
fi
if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then
# sanitize check
if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then
VAR="invalid_cadence";
export PUBLISH_DOCKER_TAG="invalid_cadence";
else
VAR="${SCHEDULE_CADENCE}";
export PUBLISH_DOCKER_TAG="${SCHEDULE_CADENCE}";
fi
return 0;
fi
if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then
VAR="master";
export PUBLISH_DOCKER_TAG="master";
return 0;
fi
}