From ae55fc7cc2d4d29f6cfe63f5294ec8bd97d15479 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Wed, 12 Jun 2019 22:01:56 -0400 Subject: [PATCH] Use login shell in docker-get-container-tag.sh Add -l to /bin/bash shebang line at top of docker-get-container-tag.sh to make it a login shell, which automatically includes /home/jenkins/.local/bin on the path, because that is where pip installs the yq command. Signed-off-by: Lott, Christopher (cl778h) Change-Id: I6b715b8d3757414344fe154d9b8a0d44feb1daaa --- .../repair-container-tag-script-shebang-a76d9cabc755c331.yaml | 7 +++++++ shell/docker-get-container-tag.sh | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/repair-container-tag-script-shebang-a76d9cabc755c331.yaml diff --git a/releasenotes/notes/repair-container-tag-script-shebang-a76d9cabc755c331.yaml b/releasenotes/notes/repair-container-tag-script-shebang-a76d9cabc755c331.yaml new file mode 100644 index 00000000..dd329a61 --- /dev/null +++ b/releasenotes/notes/repair-container-tag-script-shebang-a76d9cabc755c331.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Add -l to /bin/bash shebang line at top of docker-get-container-tag.sh + to make it a login shell, which automatically includes + /home/jenkins/.local/bin on the path, because that is where pip + installs the yq command. 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." -- 2.16.6