Skip to content

Commit 268274f

Browse files
authored
Rollup merge of rust-lang#73952 - ehuss:docker-dev, r=Mark-Simulacrum
Add option for local docker testing. This adds the option `--dev` to `src/ci/docker/run.sh` so that it will enter an interactive environment for local testing. I have often needed this for testing things, but I always needed to edit this script. I wanted the ability to interact in the environment, run different commands, inspect errors, etc.
2 parents 7a48a8e + 4dc5685 commit 268274f

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/ci/docker/run.sh

+31-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,27 @@ set -e
55
export MSYS_NO_PATHCONV=1
66

77
script=`cd $(dirname $0) && pwd`/`basename $0`
8-
image=$1
8+
9+
image=""
10+
dev=0
11+
12+
while [[ $# -gt 0 ]]
13+
do
14+
case "$1" in
15+
--dev)
16+
dev=1
17+
;;
18+
*)
19+
if [ -n "$image" ]
20+
then
21+
echo "expected single argument for the image name"
22+
exit 1
23+
fi
24+
image="$1"
25+
;;
26+
esac
27+
shift
28+
done
929

1030
docker_dir="`dirname $script`"
1131
ci_dir="`dirname $docker_dir`"
@@ -163,6 +183,15 @@ else
163183
args="$args --env LOCAL_USER_ID=`id -u`"
164184
fi
165185

186+
if [ "$dev" = "1" ]
187+
then
188+
# Interactive + TTY
189+
args="$args -it"
190+
command="/bin/bash"
191+
else
192+
command="/checkout/src/ci/run.sh"
193+
fi
194+
166195
docker \
167196
run \
168197
--workdir /checkout/obj \
@@ -183,7 +212,7 @@ docker \
183212
--init \
184213
--rm \
185214
rust-ci \
186-
/checkout/src/ci/run.sh
215+
$command
187216

188217
if [ -f /.dockerenv ]; then
189218
rm -rf $objdir

0 commit comments

Comments
 (0)