1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-11-09 10:09:56 +01:00

Add RETRY_FETCHES setting (#495)

* add RETRY_FETCHES setting

* add documentation for RETRY_FETCHES

* Improve documentation on default and allowed values
This commit is contained in:
Konrad Mösch 2023-12-20 20:35:52 +01:00 committed by Pete Fotheringham
parent fe39aa5191
commit 8ea671271a
3 changed files with 20 additions and 3 deletions

@ -116,6 +116,11 @@ ENV BUILD_TYPE "userdebug"
# we can use --depth=1 here
ENV REPO_INIT_ARGS ""
# You can specify the number of retries for repo sync here. This is useful if you get connection errors during repo sync. The value will be directly forwarded to the repo command
# Default: unset; repo uses default retry mechanism
# Allowed values: positive, non-null integers
ENV RETRY_FETCHES=
# You can optionally specify a USERSCRIPTS_DIR volume containing these scripts:
# * begin.sh, run at the very beginning
# * before.sh, run after the syncing and patching, before starting the builds

@ -199,7 +199,9 @@ Other useful settings are:
* `ZIP_SUBDIR (true)`: Move the resulting zips to $ZIP_DIR/$codename instead of $ZIP_DIR/
* `PARALLEL_JOBS`: Limit the number of parallel jobs to run (`-j` for `repo sync` and `mka`).
By default, the build system should match the number of parallel jobs to the number of cpu
cores on your machine. Reducing this number can help keeping it responsive for other tasks.
cores on your machine. Reducing this number can help keeping it responsive for other tasks.
* `RETRY_FETCHES`: Set the number of retries for the fetch during `repo sync`. By default, this value is unset (default `repo sync` retry behavior).
Positive values greater than 0 are allowed.
The full list of settings, including the less interesting ones not mentioned in
this guide, can be found in the [Dockerfile][dockerfile].

@ -66,6 +66,16 @@ if [ -n "${PARALLEL_JOBS-}" ]; then
fi
fi
retry_fetches_arg=()
if [ -n "${RETRY_FETCHES-}" ]; then
if [[ "$RETRY_FETCHES" =~ ^[1-9][0-9]*$ ]]; then
retry_fetches_arg+=( "--retry-fetches=$RETRY_FETCHES" )
else
echo "RETRY_FETCHES is not a positive number: $RETRY_FETCHES"
exit 1
fi
fi
if [ "$LOCAL_MIRROR" = true ]; then
@ -89,7 +99,7 @@ if [ "$LOCAL_MIRROR" = true ]; then
fi
echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log"
repo sync "${jobs_arg[@]}" --force-sync --no-clone-bundle &>> "$repo_log"
repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --force-sync --no-clone-bundle &>> "$repo_log"
fi
for branch in ${BRANCH_NAME//,/ }; do
@ -188,7 +198,7 @@ for branch in ${BRANCH_NAME//,/ }; do
echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log"
builddate=$(date +%Y%m%d)
repo sync "${jobs_arg[@]}" -c --force-sync &>> "$repo_log"
repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" -c --force-sync &>> "$repo_log"
if [ ! -d "vendor/$vendor" ]; then
echo ">> [$(date)] Missing \"vendor/$vendor\", aborting"