Created
February 7, 2017 17:19
-
-
Save baude/d4ce3f30ba6412ae13d9b9e089f7d509 to your computer and use it in GitHub Desktop.
Setup an Atomic CLI test environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Allows user to setup a fresh atomic CLI environment on an atomic | |
# or cloud system. | |
# Usage: | |
# Pull projectatomic/atomic master and install it | |
# $ sh setup_atomic_cli.sh | |
# Pull a user's branch | |
# $ BRANCH=<branch> GIT_USER=<user> sh setup_atomic_cli.sh | |
fail () { | |
echo "Failed ...." | |
} | |
BRANCH=${BRANCH:-master} | |
GIT_USER=${GIT_USER:-} | |
which docker | |
HAS_DOCKER=($?) | |
trap fail EXIT | |
if [ ${HAS_DOCKER} == 1 ]; then | |
if [ -z ${GIT_USER} ]; then | |
URL="https://codeload.github.com/projectatomic/atomic/legacy.tar.gz/${BRANCH}" | |
else | |
URL="https://codeload.github.com/$GIT_USER/atomic/legacy.tar.gz/${BRANCH}" | |
fi | |
curl ${URL} | tar xz | |
if [ -z ${GIT_USER} ]; then | |
cd projectatomic-atomic* | |
else | |
cd $GIT_USER-atomic-* | |
fi | |
else | |
sudo docker pull docker.io/projectatomic/atomic-tester | |
DOCKER_RUN="docker run --rm \ | |
--privileged \ | |
-v $PWD:/code \ | |
-v /:/host \ | |
--workdir /code \ | |
projectatomic/atomic-tester" | |
if [ -z ${GIT_USER} ]; then | |
URL="https://github.com/projectatomic/atomic" | |
else | |
URL="https://github.com/$GIT_USER/atomic" | |
fi | |
sudo $DOCKER_RUN git clone -b ${BRANCH} ${URL} | |
cd atomic | |
fi | |
sudo NO_TEST=1 sh .redhat-ci.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment