Feature/docker kuntoon (#11)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 25s
CI Main / Check existing artifact (push) Successful in 22s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m47s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m4s
ci-docker-build-push Docker build & push 0.2.0 OK
CI Main / Build & Push Docker (push) Successful in 35s
CI Main / Report Summary (push) Successful in 4s

Co-authored-by: moilanik <niko.moilanen@tietoevry.com>
Reviewed-on: #11
This commit is contained in:
2026-06-15 17:22:04 +03:00
parent 3d45b08f70
commit f7b2353eb9
27 changed files with 994 additions and 801 deletions
+30 -13
View File
@@ -16,24 +16,41 @@ curl_with_host() {
declare -A BRANCH_CACHE
branch_exists() {
local owner="$1" repo="$2" branch="$3" key="${owner}/${repo}/${branch}"
local status
local status attempt
[ -z "$GITEA_API_URL" ] && return 0
[ -z "$GITEA_TOKEN" ] && return 0
if [ "${BRANCH_CACHE[$key]:-}" = "1" ]; then
return 0
fi
status=$(curl -sS -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${GITEA_TOKEN}" \
"${GITEA_API_URL}/api/v1/repos/${owner}/${repo}/branches/${branch}" 2>/dev/null || echo "000")
if [ "$status" = "200" ]; then
BRANCH_CACHE[$key]=1
return 0
fi
return 1
# Retry up to 2 times on API errors (hardcoded)
for attempt in 1 2 3; do
status=$(curl -sS -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${GITEA_TOKEN}" \
"${GITEA_API_URL}/api/v1/repos/${owner}/${repo}/branches/${branch}" 2>/dev/null || echo "000")
if [ "$status" = "200" ]; then
BRANCH_CACHE[$key]=1
return 0
fi
if [ "$status" = "404" ]; then
return 1
fi
# API error - retry if not last attempt
if [ "$attempt" -lt 3 ]; then
sleep 10
continue
fi
done
# All retries failed - keep report (fail-safe)
echo " WARN: Gitea API error for ${owner}/${repo}/${branch} (status ${status}) after 3 attempts - KEEPING report"
BRANCH_CACHE[$key]=1
return 0
}
default_max_age=$(jq -r '.branches.default.maxAgeDays // 90' "$CONFIG")