Files
gitea-ci-library/scripts/ci-validate.sh
T
niko bd6ed5c2c2
CI Gitea Reports Main / Config load (push) Successful in 17s
CI Main / Config load (push) Successful in 20s
CI Gitea Reports Main / Latest version (push) Successful in 17s
CI Main / Latest versio (push) Successful in 19s
ci-helm-build-push Helm push 0.2.0
CI Gitea Reports Main / Build & Push Helm chart (push) Successful in 33s
gitops/gitea-ci-library/gitea-reports GitOps: gitea-reports 0.2.0
CI Gitea Reports Main / GitOps (push) Successful in 33s
CI Gitea Reports Main / Report Summary (push) Successful in 3s
CI Main / Bats tests (push) Failing after 1m16s
CI Main / Cucumber tests (push) Failing after 1m22s
CI Main / Build & Push Docker (push) Has been skipped
CI Main / GitOps (push) Has been skipped
CI Main / Move provider version tag (push) Has been skipped
CI Main / Report Summary (push) Successful in 3s
Feature/git pages -> oma nginx perusteinen raporointipalvelu (#48)
Co-authored-by: moilanik <niko.moilanen@tietoevry.com>
Reviewed-on: #48
2026-06-28 09:10:10 +03:00

32 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
CONF_FILE="${CI_CONF_FILE:-.gitea/workflows/gitea-env.conf}"
ERRORS=0
[ -f "$CONF_FILE" ] || { echo "ERROR: $CONF_FILE not found — checkout missing?" >&2; exit 1; }
echo "Reading $CONF_FILE..."
while IFS='=' read -r key value || [ -n "$key" ]; do
key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs)
[ -z "$key" ] && continue
[[ "$key" == "#"* ]] && continue
[ -z "$value" ] && echo "ERROR: $key is empty in $CONF_FILE" >&2 && ERRORS=1
if [ -n "$value" ] && [[ "$key" == *"URL"* ]] && [[ "$value" != http://* ]] && [[ "$value" != https://* ]]; then
echo "ERROR: $key should be a URL (http/https), got: $value" >&2
ERRORS=1
fi
done < "$CONF_FILE"
[ -z "${GITEA_TOKEN:-}" ] && echo "ERROR: GITEA_TOKEN secret is not set" >&2 && ERRORS=1
[ -z "${REPORTS_PUBLISH_TOKEN:-}" ] && echo "ERROR: REPORTS_PUBLISH_TOKEN secret is not set" >&2 && ERRORS=1
if [ "$ERRORS" -ne 0 ]; then
echo "FATAL: CI config validation failed" >&2
exit 1
fi
echo "OK: all CI env vars validated"