From bb1b3d84cda3e7c4bf51427c0d07ef5ba78688de Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sun, 23 Feb 2020 16:26:18 +0100 Subject: [PATCH] ta: login shell, filename expansion enabled Recent global-jjb bumps introduced changes to python-tools-install.sh which now disables filename expansion (globbing). Since TA RPM merge / ISO build jobs combine python-tools-install.sh and other sh script files into a single build step (i.e. resulting a single sh script), this breaks globbing for the TA RPM/ISO upload handling. Also, since python-tools-install.sh does not run as a login shell (`bash -l`), ~/.profile is not sourced and PATH might be missing certain paths like ~/.local/bin, where `lftools` is located, resulting in build failures due to missing/not found `lftools`. To mitigate the above issues: 1. split the offending build step into 2 separate steps to allow spawning the second step under a login shell (without modifying python-tools-install.sh); 2. Run the second step under a login shell, so PATH contains `lftools` installed by pip; 3. Add `set +f` to enable globbing (this is not critical after splitting the build step above, since python-tools-install.sh disabling globbing will no longer affect the second step; but it should make it more obvious that the script *requires* globbing); Change-Id: I4a5e6a4a88a296cb21d68338f8e5a5b219076308 Signed-off-by: Alexandru Avadanii --- jjb/akraino-templates/akraino-ta-common-macros.yaml | 2 ++ jjb/shell/ta-iso-deploy.sh | 4 +++- jjb/shell/ta-rpm-deploy.sh | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jjb/akraino-templates/akraino-ta-common-macros.yaml b/jjb/akraino-templates/akraino-ta-common-macros.yaml index 782e6b8..1f6bcb3 100644 --- a/jjb/akraino-templates/akraino-ta-common-macros.yaml +++ b/jjb/akraino-templates/akraino-ta-common-macros.yaml @@ -201,6 +201,7 @@ # Ensure python-tools are installed in case job template does not # call the lf-infra-pre-build macro. - ../../global-jjb/shell/python-tools-install.sh + - shell: !include-raw: - ../shell/ta-rpm-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh @@ -220,6 +221,7 @@ # Ensure python-tools are installed in case job template does not # call the lf-infra-pre-build macro. - ../../global-jjb/shell/python-tools-install.sh + - shell: !include-raw: - ../shell/ta-iso-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh diff --git a/jjb/shell/ta-iso-deploy.sh b/jjb/shell/ta-iso-deploy.sh index 1ec4731..705ac3c 100644 --- a/jjb/shell/ta-iso-deploy.sh +++ b/jjb/shell/ta-iso-deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -16,6 +16,8 @@ set -eu -o pipefail set -x # Trace commands for this script to make debugging easier. +set +f # Ensure filename expansion (globbing) is enabled + NEXUS_REPO=images-snapshots release_path=TA/release-1 diff --git a/jjb/shell/ta-rpm-deploy.sh b/jjb/shell/ta-rpm-deploy.sh index f0381e8..d742333 100644 --- a/jjb/shell/ta-rpm-deploy.sh +++ b/jjb/shell/ta-rpm-deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -16,6 +16,8 @@ set -eu -o pipefail set -x # Trace commands for this script to make debugging easier. +set +f # Ensure filename expansion (globbing) is enabled + NEXUS_REPO=rpm.snapshots release_path=TA/release-1 -- 2.16.6