Corriger la préparation de rotation Gitea
This commit is contained in:
@@ -49,17 +49,19 @@ read_env_token() {
|
||||
|
||||
validate_token() {
|
||||
local token="$1"
|
||||
local response
|
||||
local response status result=1
|
||||
response="$(mktemp /tmp/gitea-token-validation.XXXXXX)"
|
||||
trap 'rm -f "${response}"' RETURN
|
||||
local status
|
||||
status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/user")"
|
||||
[[ "${status}" == "200" ]] || return 1
|
||||
grep -q '"login":"manus-admin"' "${response}"
|
||||
status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/manus-dashboard")"
|
||||
[[ "${status}" == "200" ]] || return 1
|
||||
status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/referentiel-ia")"
|
||||
[[ "${status}" == "200" ]]
|
||||
if status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/user")" \
|
||||
&& [[ "${status}" == "200" ]] \
|
||||
&& grep -q '"login":"manus-admin"' "${response}" \
|
||||
&& status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/manus-dashboard")" \
|
||||
&& [[ "${status}" == "200" ]] \
|
||||
&& status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/referentiel-ia")" \
|
||||
&& [[ "${status}" == "200" ]]; then
|
||||
result=0
|
||||
fi
|
||||
rm -f "${response}"
|
||||
return "${result}"
|
||||
}
|
||||
|
||||
rotation_due() {
|
||||
|
||||
@@ -13,6 +13,7 @@ assert.match(rotation, /GITEA_ROTATION_APPLIED/);
|
||||
assert.match(rotation, /chmod 0600/);
|
||||
assert.match(rotation, /rollback/);
|
||||
assert.doesNotMatch(rotation, /GITEA_PASSWORD/);
|
||||
assert.doesNotMatch(rotation, /trap .*RETURN/);
|
||||
assert.match(timer, /OnCalendar=\*-01,04,07,10-01 07:00:00/);
|
||||
assert.match(timer, /Persistent=true/);
|
||||
assert.match(approvalPath, /PathExists=.*approval\.request/);
|
||||
|
||||
Reference in New Issue
Block a user