Skip to content
Snippets Groups Projects
Commit e3e1f479 authored by Björn Dieding's avatar Björn Dieding
Browse files

feat: Refactor ci_container_push_build to simplify parameter handling

parent ed201dc3
No related branches found
No related tags found
No related merge requests found
......@@ -194,9 +194,8 @@ ci_container_get_release_tag() {
# 2. Is the image a release (defined by CI_RELEASE_REGISTRY_IMAGE)?
function ci_container_push_build() {
ci_registry_token_login
echo "[debug] Params: $1 $2"
local latest="${1:-false}"
local release="${2:-false}"
echo "[debug] Params: $1"
local release="${1:-false}"
echo "$(date +[%T];) Container pushing."
# This is the only and first time we push CI_COMMIT_SHA
......@@ -209,7 +208,7 @@ function ci_container_push_build() {
$CONTAINER_RUNTIME_PUSH $CI_REGISTRY_IMAGE:$CI_CONTAINER_RELEASE_TAG
echo "[info][tag] Pushed $CI_REGISTRY_IMAGE:$CI_CONTAINER_RELEASE_TAG"
if [[ "$CI_DEFAULT_BRANCH" == "$CI_COMMIT_BRANCH" && $latest == "true" ]]; then
if [[ -v $CI_COMMIT_TAG && "$CI_DEFAULT_BRANCH" == "$CI_COMMIT_BRANCH" ]]; then
echo "[info][latest] Pushing $CI_REGISTRY_IMAGE:latest"
$CONTAINER_RUNTIME tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
$CONTAINER_RUNTIME_PUSH $CI_REGISTRY_IMAGE:latest
......
......@@ -29,9 +29,6 @@ spec:
scanning-severity:
description: What level of severity should cause scanning of the built container to fail?
default: "CRITICAL"
latest:
description: Should the image be tagged as latest?
default: "true"
release-repository-enabled:
description: Should the built container image be pushed as a release?
default: "false"
......@@ -58,7 +55,7 @@ build:$[[ inputs.name ]]:
- |
source <(curl -s https://$CI_SERVER_HOST/xrow-public/ci-tools/-/raw/main/scripts/library.sh)
ci_container_build $[[ inputs.path ]] $[[ inputs.name ]]
ci_container_push_build $[[ inputs.latest ]] $[[ inputs.release-repository-enabled ]]
ci_container_push_build $[[ inputs.release-repository-enabled ]]
artifacts:
paths:
- release/appversion
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment