Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea cloud: repo.sh and git-credential-raea say why raea refused (CR21)

shinyobjectz4ad870b947ec
diff --git a/sdk/cloud/deploy/git/git-credential-raea b/sdk/cloud/deploy/git/git-credential-raea
index a7ba14da..7ca227ff 100755
--- a/sdk/cloud/deploy/git/git-credential-raea
+++ b/sdk/cloud/deploy/git/git-credential-raea
@@ -39,9 +39,10 @@ if [ -z "$owner" ] || [ -z "$project" ]; then
echo "git-credential-raea: this repo has no raea.owner and raea.project (repo.sh sets them)" >&2
exit 1
fi
-out=$(curl -fsS -m 30 -X POST -H "authorization: Bearer $(token)" -H 'content-type: application/json' \
+# --fail-with-body: a refusal's reason (402 enterprise_required: Git on raea's servers is raea Enterprise's for now)
+out=$(curl -sS --fail-with-body -m 30 -X POST -H "authorization: Bearer $(token)" -H 'content-type: application/json' \
-d "{\"scope\":\"${RAEA_REPO_SCOPE:-write}\"}" "$api/v1/repos/$owner/$project/token") || {
- echo "git-credential-raea: raea's server gave no token for $project" >&2
+ echo "git-credential-raea: raea's server gave no token for $project: ${out:-no answer}" >&2
exit 1
}
t=$(printf %s "$out" | python3 -c 'import json, sys; print(json.load(sys.stdin)["token"])')
diff --git a/sdk/cloud/deploy/git/repo.sh b/sdk/cloud/deploy/git/repo.sh
index f341739c..d3054f70 100755
--- a/sdk/cloud/deploy/git/repo.sh
+++ b/sdk/cloud/deploy/git/repo.sh
@@ -17,7 +17,13 @@ helper=$here/git-credential-raea
call() {
local t=${RAEA_AGENT_KEY:-${RAEA_TOKEN:-}}
[ -n "$t" ] || t=$(/usr/bin/security find-generic-password -s "${RAEA_KEYCHAIN:-raea}" -a device-token -w 2>/dev/null) || { echo "repo: no raea sign-in" >&2; exit 1; }
- curl -fsS -m 60 -X "$1" -H "authorization: Bearer $t" -H 'content-type: application/json' ${3:+-d "$3"} "$api$2"
+ # a refusal says why (402 enterprise_required: Git on raea's servers is raea Enterprise's for now)
+ local out
+ out=$(curl -sS --fail-with-body -m 60 -X "$1" -H "authorization: Bearer $t" -H 'content-type: application/json' ${3:+-d "$3"} "$api$2") || {
+ echo "repo: raea said no to $1 $2: ${out:-no answer}" >&2
+ exit 1
+ }
+ printf %s "$out"
}
field() { python3 -c 'import json, sys; print(json.load(sys.stdin)[sys.argv[1]])' "$1"; }
hostof() { local u=${1#*://}; printf '%s://%s' "${1%%://*}" "${u%%/*}"; }