X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fdocker-get-container-tag.sh;h=f0e7d43cc736f6e8339d053e7aadb35275bdc036;hb=refs%2Fchanges%2F50%2F72650%2F2;hp=e522e220045bb27f75b57d5ee63b576acea4c384;hpb=f88c7c24b2b1a6f04f85afa8c0a91d8321aef8ea;p=releng%2Fglobal-jjb.git diff --git a/shell/docker-get-container-tag.sh b/shell/docker-get-container-tag.sh index e522e220..f0e7d43c 100644 --- a/shell/docker-get-container-tag.sh +++ b/shell/docker-get-container-tag.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2019 The Linux Foundation and others. @@ -8,24 +8,34 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## + echo "---> docker-get-container-tag.sh" + # Gets the container tag per $CONTAINER_TAG_METHOD # For YAML file use directory $CONTAINER_TAG_YAML_DIR -# if value is provided, else fall back to $DOCKER_ROOT +# if a value is provided, else fall back to $DOCKER_ROOT +# use login flag to get $HOME/.local/bin in PATH set -feu -o pipefail +# shellcheck disable=SC1090 +. ~/lf-env.sh + +lf-activate-venv --python python3 yq + tag="" if [[ $CONTAINER_TAG_METHOD == "latest" ]]; then tag="latest" +elif [[ $CONTAINER_TAG_METHOD == "stream" ]]; then + tag="$STREAM" elif [[ $CONTAINER_TAG_METHOD == "git-describe" ]]; then tag=$(git describe) elif [[ $CONTAINER_TAG_METHOD == "yaml-file" ]]; then - # TODO: set default value in JJB? dir=${CONTAINER_TAG_YAML_DIR:-$DOCKER_ROOT} tag_file=$dir/container-tag.yaml if [[ -f $tag_file ]]; then - tag=$(yq -r .tag tag_file) + # pip installs yq to $HOME/.local/bin + tag=$(yq -r .tag "$tag_file") else echo "File $tag_file not found." fi