Skip to content

Commit c23bdcd

Browse files
authored
Suffix the depot path with a colon (#61)
This ensure depot-shipped package images can be re-used. Also fixes CI as much as possible without tagging a release.
1 parent 1b3c741 commit c23bdcd

3 files changed

Lines changed: 52 additions & 27 deletions

File tree

.buildkite/pipeline.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ steps:
3333
3434
# Launch Linux jobs
3535
AGENT_OS="linux"
36-
upload_pipelines x86_64 "1 1.6.0 1.8 nightly"
36+
upload_pipelines x86_64 "1 1.10 nightly"
3737
upload_pipelines i686 "1 nightly"
3838
upload_pipelines aarch64 "1 nightly"
3939
40-
# Waiting for the armv7l build pipeline to be fixed so we can get newer builds
41-
upload_pipelines arm "1.7"
40+
# PowerPC was last supported in Julia 1.10
41+
upload_pipelines powerpc64le "1.10"
4242
43-
# We don't have a 1.8.X build for ppc64le, so install 1.7 and nightly
44-
upload_pipelines powerpc64le "1.7 nightly"
43+
# ARMv7 was last supported in Julia 1.7
44+
upload_pipelines arm "1.7"
4545
4646
# Launch macOS jobs
4747
AGENT_OS="macos"

hooks/pre-command

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,35 @@ fi
3030
# packages, artifacts and compiled `.ji` files
3131
if [[ "${BUILDKITE_PLUGIN_JULIA_ISOLATED_DEPOT:-true}" == "true" ]]; then
3232
# Export `JULIA_DEPOT_PATH` so that future julia invocations use this depot
33-
export JULIA_DEPOT_PATH="${CACHE_DIR}/depots/${BUILDKITE_PIPELINE_ID}"
33+
export DEPOT_DIR="${CACHE_DIR}/depots/${BUILDKITE_PIPELINE_ID}"
34+
if [[ "$OSTYPE" == "msys" ]]; then
35+
export JULIA_DEPOT_PATH="${DEPOT_DIR};"
36+
else
37+
export JULIA_DEPOT_PATH="${DEPOT_DIR}:"
38+
fi
3439
PERSIST_DEPOT_DIRS="$(echo ${BUILDKITE_PLUGIN_JULIA_PERSIST_DEPOT_DIRS:-packages,artifacts,compiled,logs,datadeps,scratchspaces} | tr ',' ' ' )"
3540

3641
# Helper function to join a list of arguments by a particular character
3742
function join_by { local IFS="$1"; shift; echo "$*"; }
3843

3944
# If the depot we're isolating ourselves inside of actually exists, we clean out
4045
# any directories not explicitly saved via `PERSIST_DEPOT_DIRS`
41-
if [[ -d "${JULIA_DEPOT_PATH}" ]]; then
42-
echo "--- :broom: Cleaning out depot at ${JULIA_DEPOT_PATH}, persisting: '${PERSIST_DEPOT_DIRS}'"
43-
pushd "${JULIA_DEPOT_PATH}" >/dev/null
46+
if [[ -d "${DEPOT_DIR}" ]]; then
47+
echo "--- :broom: Cleaning out depot at ${DEPOT_DIR}, persisting: '${PERSIST_DEPOT_DIRS}'"
48+
pushd "${DEPOT_DIR}" >/dev/null
4449
rm -rf -- !($(join_by "|" ${PERSIST_DEPOT_DIRS}))
4550
popd >/dev/null
4651

4752
# Clean out any stale pidfiles that may have come from a cancelled run,
4853
# as it's not possible for another job to be running concurrently.
49-
if [[ -d "${JULIA_DEPOT_PATH}"/compiled ]]; then
50-
find "${JULIA_DEPOT_PATH}"/compiled -name '*.pidfile' -delete
54+
if [[ -d "${DEPOT_DIR}"/compiled ]]; then
55+
find "${DEPOT_DIR}"/compiled -name '*.pidfile' -delete
5156
fi
5257
fi
5358

5459
# Mark the depot as in-use by touching it
55-
if [[ -d "${JULIA_DEPOT_PATH}" ]]; then
56-
touch "${JULIA_DEPOT_PATH}"
60+
if [[ -d "${DEPOT_DIR}" ]]; then
61+
touch "${DEPOT_DIR}"
5762
fi
5863
else
5964
if [[ -v BUILDKITE_PLUGIN_JULIA_PERSIST_DEPOT_DIRS ]]; then
@@ -320,3 +325,5 @@ else
320325
done
321326
export PATH="${MSYS_PATH}"
322327
fi
328+
329+
export BUILDKITE_PLUGIN_JULIA_SUCCESS="true"

hooks/pre-exit

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22
set -euo pipefail
33
shopt -s extglob
44

5+
6+
## Set some global configuration options, but allow users to override them
7+
58
## If we're running in debug mode, be REALLY VERBOSE:
69
if [[ "${BUILDKITE_PLUGIN_JULIA_DEBUG_PLUGIN:-false}" == "true" ]]; then
10+
PS4="> "
711
set -x
812
fi
913

1014
CACHE_DIR=${BUILDKITE_PLUGIN_JULIA_CACHE_DIR:-${HOME}/.cache/julia-buildkite-plugin}
1115

1216
echo "--- :broom: Performing clean-up"
1317

18+
if [[ "${BUILDKITE_PLUGIN_JULIA_SUCCESS:-false}" != "true" ]]; then
19+
echo "Skipping clean-up since the plugin did not successfully run."
20+
exit 0
21+
fi
22+
1423

1524
### Step 1: Remove any code coverage files.
1625

@@ -23,21 +32,23 @@ fi
2332

2433
# Some packages check coverage files in, so only remove writable ones
2534
if [[ "${BUILDKITE_PLUGIN_JULIA_ISOLATED_DEPOT:-true}" == "true" && \
26-
-d "${JULIA_DEPOT_PATH}"/packages ]]; then
27-
find "${JULIA_DEPOT_PATH}"/packages -name "*.jl.*.cov" -type f -perm -200 -delete
35+
-d "${DEPOT_DIR}"/packages ]]; then
36+
find "${DEPOT_DIR}"/packages -name "*.jl.*.cov" -type f -perm -200 -delete
2837
fi
2938

3039

3140
### Step 2: Reduce the size of our depot by removing old precompilation files.
3241

42+
echo "Removing old precompilation files"
43+
3344
# Julia does not track when a precompilation file was last used, so we simply
3445
# remove files in the `compiled` directory until we are below the limit.
3546

3647
# default limit: 1 GiB
3748
COMPILED_LIMIT="${BUILDKITE_PLUGIN_JULIA_COMPILED_SIZE_LIMIT:-1073741824}"
3849

3950
if [[ "${BUILDKITE_PLUGIN_JULIA_ISOLATED_DEPOT:-true}" == "true" ]]; then
40-
COMPILED_DIR="${JULIA_DEPOT_PATH}/compiled"
51+
COMPILED_DIR="${DEPOT_DIR}/compiled"
4152
if [[ -d "${COMPILED_DIR}" ]]; then
4253
COMPILED_SIZE_HUMAN=$(du -h -s "${COMPILED_DIR}" | cut -f 1)
4354
# `-k` gives consistently the number of kilobytes on macOS and Linux,
@@ -87,6 +98,8 @@ fi
8798

8899
### Step 3: Reduce the size of our depot by removing old artifacts.
89100

101+
echo "Removing old artifacts"
102+
90103
# This is normally done by `Pkg.gc`, however, since manifests are ephemeral
91104
# (and logs directories may not even persist) that doesn't work well.
92105
# So instead we remove directories based on their creation time.
@@ -95,7 +108,7 @@ fi
95108
ARTIFACTS_LIMIT="${BUILDKITE_PLUGIN_JULIA_ARTIFACTS_SIZE_LIMIT:-10737418240}"
96109

97110
if [[ "${BUILDKITE_PLUGIN_JULIA_ISOLATED_DEPOT:-true}" == "true" ]]; then
98-
ARTIFACTS_DIR="${JULIA_DEPOT_PATH}/artifacts"
111+
ARTIFACTS_DIR="${DEPOT_DIR}/artifacts"
99112
if [[ -d "${ARTIFACTS_DIR}" ]]; then
100113
ARTIFACTS_SIZE_HUMAN=$(du -h -s "${ARTIFACTS_DIR}" | cut -f 1)
101114
# `-k` gives consistently the number of kilobytes on macOS and Linux,
@@ -151,22 +164,27 @@ DEPOT_LIMIT_DEFAULT=$(($COMPILED_LIMIT+$ARTIFACTS_LIMIT+10737418240))
151164
DEPOT_LIMIT="${BUILDKITE_PLUGIN_JULIA_DEPOT_SIZE_LIMIT:-${DEPOT_LIMIT_DEFAULT}}"
152165

153166
if [[ "${BUILDKITE_PLUGIN_JULIA_ISOLATED_DEPOT:-true}" == "true" ]]; then
154-
DEPOT_SIZE_HUMAN=$(du -h -s "${JULIA_DEPOT_PATH}" | cut -f 1)
155-
# `-k` gives consistently the number of kilobytes on both macOS and Linux,
156-
# without it BSD `du` would give the number of multiples of 512 bytes.
157-
DEPOT_SIZE=$(($(du -k -s "${JULIA_DEPOT_PATH}" | cut -f 1) * 1024))
158-
echo "The depot size is: ${DEPOT_SIZE_HUMAN}"
159-
160-
if [[ ${DEPOT_SIZE} -gt ${DEPOT_LIMIT} ]]; then
161-
echo "This is greater than the limit (${DEPOT_SIZE} > ${DEPOT_LIMIT} bytes), so we will clear the entire depot"
162-
rm -rf "${JULIA_DEPOT_PATH}"
163-
mkdir -p "${JULIA_DEPOT_PATH}"
167+
echo "Checking overall depot size at ${DEPOT_DIR}"
168+
if [[ -d "${DEPOT_DIR}" ]]; then
169+
DEPOT_SIZE_HUMAN=$(du -h -s "${DEPOT_DIR}" | cut -f 1)
170+
# `-k` gives consistently the number of kilobytes on both macOS and Linux,
171+
# without it BSD `du` would give the number of multiples of 512 bytes.
172+
DEPOT_SIZE=$(($(du -k -s "${DEPOT_DIR}" | cut -f 1) * 1024))
173+
echo "The depot size is: ${DEPOT_SIZE_HUMAN}"
174+
175+
if [[ ${DEPOT_SIZE} -gt ${DEPOT_LIMIT} ]]; then
176+
echo "This is greater than the limit (${DEPOT_SIZE} > ${DEPOT_LIMIT} bytes), so we will clear the entire depot"
177+
rm -rf "${DEPOT_DIR}"
178+
mkdir -p "${DEPOT_DIR}"
179+
fi
164180
fi
165181
fi
166182

167183

168184
### Step 5: Remove old depots.
169185

186+
echo "Removing old depots"
187+
170188
# We mark a depot as in-use by `touch`ing it at the start of the pipeline,
171189
# so we can remove any depots that are older than a certain age.
172190

0 commit comments

Comments
 (0)