#!/bin/sh # Start from the build image's prebuilt dependencies, then run the command. # OxygenFlow's rust image holds this workspace's dependencies built at /src with # this pipeline's environment (oxygenflow/images/rust, backlog F6b2); the # job's target disk starts empty, so copying them in leaves cargo only this # workspace's own crates to compile. Without them (an older image, or a # failed copy) the job simply builds everything, as before. set -eu warm=/opt/warm/oxygen # A fresh ext4 target disk holds only lost+found. if [ -d "$warm" ] && [ -z "$(ls -A target 2>/dev/null | grep -vx 'lost+found')" ]; then start=$(date +%s) if cp -R --preserve=timestamps "$warm/." target/; then echo "flow: prebuilt dependencies copied in $(( $(date +%s) - start )) s" else echo "flow: could not copy the prebuilt dependencies; building them" >&2 rm -rf target/* 2>/dev/null || true fi fi exec "$@"