diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-09 06:14:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 06:14:17 -0400 |
commit | 71d675a164ee64111db1a9214673a3498b3aa123 (patch) | |
tree | 6a047ed67886d28899125717931869ee368eaeea /contrib/cirrus/lib.sh | |
parent | 2694fb85f46f43973672ed473b887c634819b71d (diff) | |
parent | 5b7c64cc97e8bf912c6ab7492827e2b871cb17d1 (diff) | |
download | podman-71d675a164ee64111db1a9214673a3498b3aa123.tar.gz podman-71d675a164ee64111db1a9214673a3498b3aa123.tar.bz2 podman-71d675a164ee64111db1a9214673a3498b3aa123.zip |
Merge pull request #7944 from cevich/new_get_ci_vm
Cirrus: Fix obtaining a CI VM
Diffstat (limited to 'contrib/cirrus/lib.sh')
-rw-r--r-- | contrib/cirrus/lib.sh | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh index 23987938b..e5124d8e4 100644 --- a/contrib/cirrus/lib.sh +++ b/contrib/cirrus/lib.sh @@ -6,18 +6,20 @@ # BEGIN Global export of all variables set -a -# Due to differences across platforms and runtime execution environments, -# handling of the (otherwise) default shell setup is non-uniform. Rather -# than attempt to workaround differences, simply force-load/set required -# items every time this library is utilized. -source /etc/profile -source /etc/environment -USER="$(whoami)" -HOME="$(getent passwd $USER | cut -d : -f 6)" -# Some platforms set and make this read-only -[[ -n "$UID" ]] || \ - UID=$(getent passwd $USER | cut -d : -f 3) -GID=$(getent passwd $USER | cut -d : -f 4) +if [[ "$CI" == "true" ]]; then + # Due to differences across platforms and runtime execution environments, + # handling of the (otherwise) default shell setup is non-uniform. Rather + # than attempt to workaround differences, simply force-load/set required + # items every time this library is utilized. + source /etc/profile + source /etc/environment + USER="$(whoami)" + HOME="$(getent passwd $USER | cut -d : -f 6)" + # Some platforms set and make this read-only + [[ -n "$UID" ]] || \ + UID=$(getent passwd $USER | cut -d : -f 3) + GID=$(getent passwd $USER | cut -d : -f 4) +fi # During VM Image build, the 'containers/automation' installation # was performed. The final step of that installation sets the @@ -43,6 +45,9 @@ OS_RELEASE_ID="$(source /etc/os-release; echo $ID)" OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)" # Combined to ease soe usage OS_REL_VER="${OS_RELEASE_ID}-${OS_RELEASE_VER}" +# This is normally set from .cirrus.yml but default is necessary when +# running under hack/get_ci_vm.sh since it cannot infer the value. +DISTRO_NV="${DISTRO_NV:-$OS_REL_VER}" # Essential default paths, many are overridden when executing under Cirrus-CI GOPATH="${GOPATH:-/var/tmp/go}" |