diff options
author | Chris Evich <cevich@redhat.com> | 2019-03-18 15:17:46 -0400 |
---|---|---|
committer | Chris Evich <cevich@redhat.com> | 2019-03-19 13:00:18 -0400 |
commit | 37eb694bd073b8dff265be137ae75eac81e9d769 (patch) | |
tree | 99e158529ea8f6b20ed1ab266c0168c9f78f68a0 /hack/get_ci_vm.sh | |
parent | 537c382f5bd098bc89a457554db9bd0b08eab3c2 (diff) | |
download | podman-37eb694bd073b8dff265be137ae75eac81e9d769.tar.gz podman-37eb694bd073b8dff265be137ae75eac81e9d769.tar.bz2 podman-37eb694bd073b8dff265be137ae75eac81e9d769.zip |
Cirrus: Various fixes for rootless testing
* Randomize the user's UID and GID
* Simplify `setup_environment.sh`
* Support new "-r" option for `hack/get_ci_vm.sh` setting up rootless
* Connect as $ROOTLESS_USER when using "-r" with `hack/get_ci_vm.sh`
Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'hack/get_ci_vm.sh')
-rwxr-xr-x | hack/get_ci_vm.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hack/get_ci_vm.sh b/hack/get_ci_vm.sh index 70fe93eb5..071b62434 100755 --- a/hack/get_ci_vm.sh +++ b/hack/get_ci_vm.sh @@ -19,6 +19,7 @@ PROJECT="libpod-218412" GOSRC="/var/tmp/go/src/github.com/containers/libpod" GCLOUD_IMAGE=${GCLOUD_IMAGE:-quay.io/cevich/gcloud_centos:latest} GCLOUD_SUDO=${GCLOUD_SUDO-sudo} +ROOTLESS_USER="madcowdog" # Shared tmp directory between container and us TMPDIR=$(mktemp -d --tmpdir $(basename $0)_tmpdir_XXXXXX) @@ -69,7 +70,9 @@ image_hints() { show_usage() { echo -e "\n${RED}ERROR: $1${NOR}" - echo -e "${YEL}Usage: $(basename $0) [-s | -p] <image_name>${NOR}\n" + echo -e "${YEL}Usage: $(basename $0) [-s | -p | -r] <image_name>${NOR}" + echo "Use -s / -p to select source or package based dependencies" + echo -e "Use -r to setup and run tests as a regular user.\n" if [[ -r ".cirrus.yml" ]] then echo -e "${YEL}Some possible image_name values (from .cirrus.yml):${NOR}" @@ -106,7 +109,7 @@ parse_args(){ IMAGE_NAME="$2" elif [[ "$1" == "-r" ]] then - DEPS="ROOTLESS_USER=madcowdog ROOTLESS_UID=3210 ROOTLESS_GID=3210" + DEPS="ROOTLESS_USER=$ROOTLESS_USER" IMAGE_NAME="$2" else # no -s or -p DEPS="$(get_env_vars)" @@ -213,4 +216,8 @@ echo -e "\n${YEL}Executing environment setup${NOR}" showrun $SSH_CMD --command "$SETUP_CMD" echo -e "\n${YEL}Connecting to $VMNAME ${RED}(option to delete VM upon logout).${NOR}\n" +if [[ "$1" == "-r" ]] +then + SSH_CMD="$PGCLOUD compute ssh $ROOTLESS_USER@$VMNAME" +fi showrun $SSH_CMD -- -t "cd $GOSRC && exec env $DEPS bash -il" |