Skip to content

Commit b3eb7a6

Browse files
committed
Add --gh-token option to install script
1 parent 3c3cb1e commit b3eb7a6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.ci/install.bash

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ do
1717
-i=* | --image=* )
1818
IMAGE_NAME="${i#*=}" ;;
1919

20+
--gh-token=* )
21+
GH_TOKEN="${i#*=}" ;;
22+
2023
--ssh )
2124
USE_SSH=true ;;
2225

@@ -63,10 +66,17 @@ then
6366
BRANCH_TAG=${MASTER_TAG}
6467
fi
6568

66-
if [ -f ~/.ssh/known_hosts ]
69+
DOCKER_ARGS=()
70+
71+
if [[ -f ~/.ssh/known_hosts ]]
6772
then
6873
MERGE_KNOWN_HOSTS="true"
69-
DOCKER_MOUNT_KNOWN_HOSTS_ARGS="--mount type=bind,source=${HOME}/.ssh/known_hosts,target=/tmp/known_hosts_extra"
74+
DOCKER_ARGS+=("--mount" "type=bind,source=${HOME}/.ssh/known_hosts,target=/tmp/known_hosts_extra")
75+
fi
76+
77+
if [[ -n "${GH_TOKEN}" ]]
78+
then
79+
DOCKER_ARGS+=("-e" "GITHUB_TOKEN=${GH_TOKEN}")
7080
fi
7181

7282
# Docker container can show a header on start-up. We don't want to capture it
@@ -83,7 +93,7 @@ mkdir -p "$HOME"/.cache/pip
8393

8494
# Run the docker image along with setting new environment variables
8595
# shellcheck disable=SC2086
86-
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache --mount type=bind,source=$HOME/.cache/pip,target=$DOCKER_HOME/.cache/pip ${DOCKER_MOUNT_KNOWN_HOSTS_ARGS} "${IMAGE_NAME}:${BRANCH_TAG}"
96+
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache --mount type=bind,source=${HOME}/.cache/pip,target=${DOCKER_HOME}/.cache/pip "${DOCKER_ARGS[@]}" "${IMAGE_NAME}:${BRANCH_TAG}"
8797

8898
# Own the ~/.ccache folder for permissions
8999
docker exec -t tue-env bash -c "sudo chown 1000:1000 -R ~/.ccache"

0 commit comments

Comments
 (0)