r) REP_NAME="$OPTARG"
;;
b) BRANCH="$OPTARG"
;;
u) URL="$OPTARG"
;;
g) GROUP_NAME="$OPTARG"
;;
l) LOCAL="$OPTARG"
;;
n) BUILD_ID="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
#printf "Argument REP_NAME is %s\n" "$REP_NAME"
#printf "Argument BRANCH is %s\n" "$BRANCH"
#printf "Argument URL is %s\n" "$URL"
#printf "Argument GROUP_NAME is %s\n" "$GROUP_NAME"
#printf "Argument LOCAL is %s\n" "$LOCAL"
HOST_NAME="$(echo $URL | cut -d/ -f 3)"
if [ "$LOCAL" = true ]; then
docker-compose up -d --build
IP_ADDRESS="$(docker exec -u 0 "${CONTAINER_NAME}_chrome_1" /bin/sh -c '/sbin/ip route | grep -m1 -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"')"
fi
docker exec -u 0 "${CONTAINER_NAME}_chrome_1" \
/bin/sh -c "! grep -q $HOST_NAME /etc/hosts && echo '$IP_ADDRESS $HOST_NAME' >> /etc/hosts || echo 0" \
&& docker-compose run -e REP_NAME=$REP_NAME \
-e BRANCH=$BRANCH \
-e URL=$URL \
-e GROUP_NAME=$GROUP_NAME \
-e IP_ADDRESS=$IP_ADDRESS \
-e BUILD_ID=$BUILD_ID \
-e LOCAL=$LOCAL \
codecept
Язабан
Обсуждают сегодня