Skip to content

Commit 8ad5f1d

Browse files
authored
Dev build cycle improvements (#277)
- Adds more assembly descriptors for producing flat directories to avoid having to compress/extract when building containers. - Provides a way to selectively enable that during container builds. - Skips generating the zip files during the CI pipelines (they were unused anyways). - Adds some unrelated minor fixups to more docker-compose scripts following #276
1 parent 7efa20e commit 8ad5f1d

File tree

18 files changed

+157
-36
lines changed

18 files changed

+157
-36
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
distribution: 'temurin'
7171

7272
- name: Package with Maven
73-
run: mvn -B package -P ${{matrix.profile}} --file pom.xml -DskipTests
73+
run: mvn -B package -P ${{matrix.profile}} --file pom.xml -DskipTests -D descriptors=src/main/assembly/tgz.xml
7474

7575
- name: Upload TGZ artifact
7676
uses: actions/upload-artifact@v3

docker/benchbase/common-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if ! docker buildx version >/dev/null 2>&1; then
7575
echo 'NOTE: docker buildkit is unavailable.' >&2
7676
DOCKER_BUILDKIT=0
7777
docker_build_args=''
78-
elif [ -z "$DOCKER_BUILDKIT" ]; then
78+
elif [ -z "${DOCKER_BUILDKIT:-}" ]; then
7979
# If not already set, default to buildkit.
8080
DOCKER_BUILDKIT=1
8181
fi

docker/benchbase/devcontainer/build-in-container.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,27 @@ SKIP_TESTS="${SKIP_TESTS:-false}"
1111

1212
cd /benchbase
1313
mkdir -p results
14+
mkdir -p profiles
15+
16+
SKIP_TEST_ARGS='-D skipTests -D maven.test.skip -D maven.javadoc.skip=true'
17+
EXTRA_MAVEN_ARGS="${EXTRA_MAVEN_ARGS:-}"
18+
19+
if [ "$CLEAN_BUILD" == false ]; then
20+
# In tight dev build loops we want to avoid regenerating classes when only
21+
# the git properties have changed.
22+
EXTRA_MAVEN_ARGS+=" -D maven.gitcommitid.skip=true"
23+
fi
1424

1525
function build_profile() {
1626
local profile="$1"
1727
# Build in a separate directory so we can do it in parallel.
1828
rm -rf profiles/$profile/
1929
mkdir -p target/$profile
20-
mvn -T 2C -B --file pom.xml package -P $profile -D skipTests -D buildDirectory=target/$profile
21-
# Extract the resultant package.
22-
mkdir -p profiles/$profile
23-
tar -C profiles/$profile/ --strip-components=1 -xvzf target/$profile/benchbase-$profile.tgz
30+
# Build the profile without tests (we did that separately).
31+
mvn -T 2C -B --file pom.xml package -D descriptors=src/main/assembly/dir.xml -P $profile \
32+
$SKIP_TEST_ARGS $EXTRA_MAVEN_ARGS -D buildDirectory=target/$profile
33+
# Copy the resultant output to the profiles directory.
34+
cp -rlv target/$profile/benchbase-$profile/benchbase-$profile profiles/$profile
2435
# Later the container entrypoint will move into this directory to run it, so
2536
# save all of the results back to the common volume mapping location.
2637
ln -s ../../results profiles/$profile/results
@@ -62,7 +73,7 @@ function clean_profile_build() {
6273
local profile="$1"
6374
echo "INFO: Cleaning profile $profile"
6475
if [ -d target/$profile ]; then
65-
mvn -B --file pom.xml -D buildDirectory=target/$profile clean
76+
mvn -B --file pom.xml $SKIP_TEST_ARGS $EXTRA_MAVEN_ARGS -D buildDirectory=target/$profile clean
6677
rm -rf target/$profile
6778
fi
6879
}
@@ -85,14 +96,14 @@ fi
8596
# Fetch resources serially to work around mvn races with downloading the same
8697
# file in multiple processes (mvn uses *.part instead of use tmpfile naming).
8798
for profile in ${BENCHBASE_PROFILES}; do
88-
mvn -T2C -B --file pom.xml -D buildDirectory=target/$profile process-resources dependency:copy-dependencies
99+
mvn -T2C -B --file pom.xml -D buildDirectory=target/$profile $EXTRA_MAVEN_ARGS process-resources dependency:copy-dependencies
89100
done
90101

91102
# Make sure that we've built the base stuff (and test) before we build individual profiles.
92-
mvn -T 2C -B --file pom.xml compile # ${TEST_TARGET:-}
103+
mvn -T 2C -B --file pom.xml $SKIP_TEST_ARGS $EXTRA_MAVEN_ARGS compile # ${TEST_TARGET:-}
93104
if [ -n "${TEST_TARGET:-}" ]; then
94105
# FIXME: Run tests without parallelism to work around some buggy behavior.
95-
mvn -B --file pom.xml $TEST_TARGET
106+
mvn -B --file pom.xml $EXTRA_MAVEN_ARGS $TEST_TARGET
96107
fi
97108

98109
for profile in ${BENCHBASE_PROFILES}; do

docker/benchbase/fullimage/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ VOLUME /benchbase/results
2222
# Only copy the content necessary for running (not building) benchbase over to the image.
2323
# These files should have been built using the devcontainer by the
2424
# build-full-image.sh script.
25-
COPY . /benchbase/
25+
COPY --chown=containeruser:containergroup . /benchbase/
2626

2727
ENTRYPOINT ["/benchbase/entrypoint.sh"]
2828
CMD ["--help"]

docker/benchbase/run-dev-image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ docker run ${INTERACTIVE_ARGS:-} --rm \
3636
--env BENCHBASE_PROFILES="$BENCHBASE_PROFILES" \
3737
--env CLEAN_BUILD="$CLEAN_BUILD" \
3838
--env SKIP_TESTS="$SKIP_TESTS" \
39+
--env EXTRA_MAVEN_ARGS="${EXTRA_MAVEN_ARGS:-}" \
3940
--user "$CONTAINERUSER_UID:$CONTAINERUSER_GID" \
4041
-v "$MAVEN_CONFIG:/home/containeruser/.m2" \
4142
-v "$SRC_DIR:/benchbase" benchbase-dev:latest $*

docker/benchbase/run-full-image.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ if ! docker image ls --quiet benchbase-$BENCHBASE_PROFILE:latest | grep -q .; th
1515
CLEAN_BUILD=true
1616
fi
1717

18-
if [ "$CLEAN_BUILD" != 'false' ]; then
18+
#if [ "$CLEAN_BUILD" != 'false' ]; then
1919
./build-full-image.sh
20-
fi
20+
#fi
2121

2222
if [ "$imagename" != 'benchbase' ]; then
2323
echo "ERROR: Unexpected imagename: $imagename" >&2
@@ -32,7 +32,7 @@ cd "$rootdir"
3232
mkdir -p results/
3333
set -x
3434
docker run -it --rm \
35-
"${EXTRA_DOCKER_ARGS:-}" \
35+
${EXTRA_DOCKER_ARGS:-} \
3636
--env=http_proxy="${http_proxy:-}" --env=https_proxy="${https_proxy:-}" \
3737
--env BENCHBASE_PROFILE="$BENCHBASE_PROFILE" \
3838
--user "$CONTAINERUSER_UID:$CONTAINERUSER_GID" \

docker/build-run-benchmark-with-docker.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,30 @@ scriptdir=$(dirname "$(readlink -f "$0")")
1717
rootdir=$(readlink -f "$scriptdir/..")
1818
cd "$rootdir"
1919

20-
if [ ! -x "docker/${BENCHBASE_PROFILE}-latest/up.sh" ]; then
21-
echo "ERROR: No docker up.sh script available for '$BENCHBASE_PROFILE'"
20+
if [ "$BENCHBASE_PROFILE" == 'sqlite' ]; then
21+
# Map the sqlite db back to the host.
22+
touch $PWD/$benchmark.db
23+
SRC_DIR="$PWD"
24+
if [ -n "$LOCAL_WORKSPACE_FOLDER" ]; then
25+
SRC_DIR="$LOCAL_WORKSPACE_FOLDER"
26+
fi
27+
EXTRA_DOCKER_ARGS="-v $SRC_DIR/$benchmark.db:/benchbase/profiles/sqlite/$benchmark.db"
28+
else
29+
if [ ! -x "docker/${BENCHBASE_PROFILE}-latest/up.sh" ]; then
30+
echo "ERROR: No docker up.sh script available for '$BENCHBASE_PROFILE'"
31+
fi
32+
33+
"./docker/${BENCHBASE_PROFILE}-latest/up.sh"
2234
fi
2335

24-
"./docker/${BENCHBASE_PROFILE}-latest/up.sh"
36+
CREATE_DB_ARGS='--create=true --load=true'
37+
if [ "${SKIP_LOAD_DB:-false}" == 'true' ]; then
38+
CREATE_DB_ARGS=''
39+
fi
2540

26-
SKIP_TESTS=${SKIP_TESTS:-true} EXTRA_DOCKER_ARGS="--network=host" \
41+
SKIP_TESTS=${SKIP_TESTS:-true} EXTRA_DOCKER_ARGS="--network=host $EXTRA_DOCKER_ARGS" \
2742
./docker/benchbase/run-full-image.sh \
2843
--config "config/sample_${benchmark}_config.xml" --bench "$benchmark" \
29-
--create=true --load=true --execute=true \
44+
$CREATE_DB_ARGS --execute=true \
3045
--sample 1 --interval-monitor 1000 \
3146
--json-histograms results/histograms.json

docker/cockroach-latest/prune.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22

3-
docker system prune -a -f --volumes
3+
set -eu
4+
scriptdir=$(dirname "$(readlink -f "$0")")
5+
cd "$scriptdir/"
6+
7+
docker system prune -a -f --volumes

docker/mariadb-latest/down.sh

100644100755
File mode changed.

docker/mariadb-latest/prune.sh

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22

3-
docker system prune -a -f --volumes
3+
set -eu
4+
scriptdir=$(dirname "$(readlink -f "$0")")
5+
cd "$scriptdir/"
6+
7+
docker system prune -a -f --volumes

0 commit comments

Comments
 (0)