OXYGENHUB
# 705d11b01a2c oxygenhub / .flow / warm-target.sh
858 B · Bourne Again Shell (bash) · executable · last changed CI starts from the build image's prebuilt dependencies 1 month ago source blame history raw
1
#!/bin/sh
2
# Start from the build image's prebuilt dependencies, then run the command.
3
# OxygenFlow's rust image holds oxygenhub's dependencies built at /src with
4
# this pipeline's environment (oxygenflow/images/rust, backlog F6b2); the
5
# job's target disk starts empty, so copying them in leaves cargo only this
6
# workspace's own crates to compile. Without them (an older image, or a
7
# failed copy) the job simply builds everything, as before.
8
set -eu
9
warm=/opt/warm/oxygenhub
10
if [ -d "$warm" ] && [ -z "$(ls -A target 2>/dev/null)" ]; then
11
    start=$(date +%s)
12
    if cp -R --preserve=timestamps "$warm/." target/; then
13
        echo "flow: prebuilt dependencies copied in $(( $(date +%s) - start )) s"
14
    else
15
        echo "flow: could not copy the prebuilt dependencies; building them" >&2
16
        rm -rf target/* 2>/dev/null || true
17
    fi
18
fi
19
exec "$@"