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