From: Alexandru Avadanii Date: Sun, 23 Feb 2020 15:26:18 +0000 (+0100) Subject: ta: login shell, filename expansion enabled X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F2253%2F2;p=ci-management.git 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 --- 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