Skip to content

Commit 5b7c29e

Browse files
committed
chore: fix checks for last repo update
1 parent 14c1ae5 commit 5b7c29e

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

.docker/build-linux.sh

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export CCACHE_CONFIGPATH=/workspace/.docker/ccache.conf
66

77
LOCAL_REPO_PATH=/local/repos
88
mkdir -p "$LOCAL_REPO_PATH"
9-
LAST_UPDATE_FILE="$LOCAL_REPO_PATH/last-update"
9+
LAST_UPDATE_BASE="$LOCAL_REPO_PATH/last-update"
1010

1111
WORKFLOW_LOG_DIR="/artifacts/workflow-logs/${GITHUB_RUN_ID}"
1212
NINJA_LOG_FILE="${WORKFLOW_LOG_DIR}/ninja-${BUILD_ARCH},${CROSS_ARCH},${BUILD_DIST},${BUILD_TYPE}.log"
@@ -19,32 +19,34 @@ log() {
1919
echo "$(python3 - <<<'from datetime import datetime; print(datetime.now().isoformat())') $event" >> "$BUILD_LOG_FILE"
2020
}
2121

22-
if [ -f "$LAST_UPDATE_FILE" ] && [ $(find "$LAST_UPDATE_FILE" -mmin -180) ]; then
23-
echo "Skipping git repo update because it already ran in the last three hours."
24-
else
25-
echo "Running git repo update."
26-
27-
log "begin:repo-update"
28-
29-
for repo in "BLAKE3-team/BLAKE3" \
30-
"fmtlib/fmt" \
31-
"google/googletest" \
32-
"ericniebler/range-v3" \
33-
"greg7mdp/parallel-hashmap"; do
34-
reponame=$(basename "$repo")
35-
cd "$LOCAL_REPO_PATH"
36-
if [ -d "$reponame" ]; then
37-
cd "$reponame"
38-
time git fetch
39-
else
40-
time git clone "https://github.com/$repo.git"
41-
fi
42-
done
22+
log "begin:repo-update"
4323

44-
log "end:repo-update"
24+
for repo in "BLAKE3-team/BLAKE3" \
25+
"fmtlib/fmt" \
26+
"google/googletest" \
27+
"ericniebler/range-v3" \
28+
"greg7mdp/parallel-hashmap"; do
29+
reponame=$(basename "$repo")
30+
cd "$LOCAL_REPO_PATH"
31+
last_update_path="$LAST_UPDATE_BASE.$reponame"
4532

46-
touch "$LAST_UPDATE_FILE"
47-
fi
33+
if [ -d "$reponame" ] && [ -f "$last_update_path" ] && [ $(find "$last_update_path" -mmin -180) ]; then
34+
echo "[$reponame] skipping repo update because it already ran in the last three hours"
35+
else
36+
echo "[$reponame] running git repo update..."
37+
38+
if [ -d "$reponame" ]; then
39+
cd "$reponame"
40+
time git fetch
41+
else
42+
time git clone "https://github.com/$repo.git"
43+
fi
44+
45+
touch "$last_update_path"
46+
fi
47+
done
48+
49+
log "end:repo-update"
4850

4951
if [[ "$BUILD_TYPE" != "clang-release-ninja-static" ]]; then
5052
export DWARFS_LOCAL_REPO_PATH="$LOCAL_REPO_PATH"

0 commit comments

Comments
 (0)