X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fdocker-get-container-tag.sh;h=df3f8ce435ad44ac39f905379cf4b8034a48eab7;hb=2a10c83b2d506008cc6c01c134515fb6328e1f3a;hp=e80194034c8d4e07e61b05fa1481a5fec0613c95;hpb=c39a78a2527e40fbf2d46204ea70468c96dd1c05;p=releng%2Fglobal-jjb.git diff --git a/shell/docker-get-container-tag.sh b/shell/docker-get-container-tag.sh index e8019403..df3f8ce4 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,10 +8,13 @@ # 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 @@ -21,10 +24,10 @@ if [[ $CONTAINER_TAG_METHOD == "latest" ]]; then 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 + # pip installs yq to $HOME/.local/bin tag=$(yq -r .tag "$tag_file") else echo "File $tag_file not found."