Reprise du rechargement, version sans prefixe v
build / Garde-fou (pull_request) Successful in 11s
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (pull_request) Skipped
build / Images Harbor (web, Dockerfile) (pull_request) Skipped
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (push) Successful in 9m45s
build / Garde-fou (push) Successful in 10s
build / Images Harbor (web, Dockerfile) (push) Successful in 11m28s
build / Garde-fou (pull_request) Successful in 11s
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (pull_request) Skipped
build / Images Harbor (web, Dockerfile) (pull_request) Skipped
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (push) Successful in 9m45s
build / Garde-fou (push) Successful in 10s
build / Images Harbor (web, Dockerfile) (push) Successful in 11m28s
This commit is contained in:
1 parent
5f76b08ae6
commit
c85aaaadf4
2 files changed
+21
-5
No files matched your search
+20
-4
@@ -20,6 +20,23 @@ if [ -z "${CATALOG_REPO:-}" ]; then
|
||||
fi
|
||||
|
||||
TRAVAIL=/tmp/depot
|
||||
TEMOIN=/tmp/derniere-revision-confirmee
|
||||
|
||||
# Previent l'application, et retient si elle a repondu. Tant que la reponse
|
||||
# n'est pas obtenue, on retente au cycle suivant : au demarrage, catalog-sync
|
||||
# publie souvent avant que web n'ecoute, et sans cette reprise le site
|
||||
# resterait sur le catalogue charge a son lancement.
|
||||
prevenir_application() {
|
||||
revision="$1"
|
||||
[ -n "${RELOAD_URL:-}" ] || return 0
|
||||
[ "$(cat "$TEMOIN" 2>/dev/null)" = "$revision" ] && return 0
|
||||
if curl -fsS --max-time 10 -X POST "$RELOAD_URL" >/dev/null 2>&1; then
|
||||
echo "$revision" > "$TEMOIN"
|
||||
echo "catalog-sync : application rechargee ($revision)"
|
||||
else
|
||||
echo "catalog-sync : application injoignable, nouvelle tentative au prochain cycle" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
sync_une_fois() {
|
||||
if [ -d "$TRAVAIL/.git" ]; then
|
||||
@@ -40,7 +57,8 @@ sync_une_fois() {
|
||||
CIBLE="$CATALOG_DEST/rev-$REVISION"
|
||||
|
||||
if [ -L "$CATALOG_DEST/actuel" ] && [ "$(readlink "$CATALOG_DEST/actuel")" = "$CIBLE" ]; then
|
||||
return 0 # deja publie, rien a faire
|
||||
prevenir_application "$REVISION" # publie, mais l'application l'ignore peut-etre encore
|
||||
return 0
|
||||
fi
|
||||
|
||||
rm -rf "$CIBLE.partiel" "$CIBLE"
|
||||
@@ -57,9 +75,7 @@ sync_une_fois() {
|
||||
done
|
||||
|
||||
echo "catalog-sync : catalogue publie ($REVISION)"
|
||||
if [ -n "${RELOAD_URL:-}" ]; then
|
||||
curl -fsS -X POST "$RELOAD_URL" >/dev/null 2>&1 || echo "catalog-sync : rechargement non confirme"
|
||||
fi
|
||||
prevenir_application "$REVISION"
|
||||
}
|
||||
|
||||
while true; do
|
||||
|
||||
Reference in new issue
Block a user