Skip to content

Commit 9de4dd8

Browse files
New josh based build sandbox
1 parent 9535c2a commit 9de4dd8

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

r/build

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -e
3+
4+
TREE=$(git write-tree)
5+
COMMIT=$(echo "WIP" | git commit-tree $TREE)
6+
git update-ref R_HEAD $COMMIT
7+
8+
git diff --stat HEAD..R_HEAD
9+
10+
josh-filter :+r/$1:/build --update refs/r/$1/build R_HEAD
11+
josh-filter :+r/$1:/run --update refs/r/$1/run R_HEAD
12+
13+
IMAGE_NAME=r-image:$(git rev-parse refs/r/$1/build^{tree})
14+
if docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
15+
echo "Image exists locally"
16+
else
17+
echo "Image does not exist locally"
18+
git archive --format=tar $(git rev-parse refs/r/$1/build^{tree}) | docker buildx build \
19+
--target=dev-local \
20+
--build-arg USER_UID=$(id -u) \
21+
--build-arg USER_GID=$(id -g) \
22+
-t $IMAGE_NAME -
23+
fi
24+
25+
vol=$1_snapshot
26+
docker volume remove "$vol" || true
27+
docker volume create "$vol"
28+
docker run --rm -v "$vol":/data busybox sh -c "chown -R $(id -u):$(id -g) /data"
29+
30+
git archive $(git rev-parse refs/r/$1/run^{tree}) | docker run --rm --user $(id -u):$(id -g) -i -v "$vol":/dst busybox tar -xC /dst
31+
32+
docker run -it --rm \
33+
-v "$vol":$PWD \
34+
-v "$PWD/tests:$PWD/tests" \
35+
-v rcache:/opt/cache \
36+
-w $PWD \
37+
--user $(id -u):$(id -g) \
38+
$IMAGE_NAME sh -c "bash run.sh ${*:2}"

r/josh.josh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
build = :[
2+
::Dockerfile
3+
::docker/
4+
::lfs-test-server/
5+
]
6+
run = :[
7+
:/r::run.sh
8+
::run-tests.sh
9+
::**/*.toml
10+
::*.toml
11+
::hyper-reverse-proxy/
12+
::hyper_cgi/
13+
::josh-cli/
14+
::josh-core/
15+
::josh-filter/
16+
::josh-graphql/
17+
::josh-proxy/
18+
::josh-rpc/
19+
::josh-ssh-dev-server/
20+
::josh-ssh-shell/
21+
::josh-templates/
22+
::josh-ui/
23+
]

r/run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set -e
2+
3+
if [[ ! -v CARGO_TARGET_DIR ]]; then
4+
echo "CARGO_TARGET_DIR not set"
5+
exit 1
6+
fi
7+
8+
export RUSTFLAGS="-D warnings"
9+
rustc -vV
10+
cargo build --workspace --exclude josh-ui --features hyper_cgi/test-server -v
11+
( cd josh-ssh-dev-server ; go build -o "\${CARGO_TARGET_DIR}/josh-ssh-dev-server" )
12+
sh run-tests.sh ${@:1:99}

0 commit comments

Comments
 (0)