Skip to content

Commit eedaeff

Browse files
swghoshclaude
andauthored
Use gh-token-minter image for token minting in CI step (#80233)
Replace inline bash/openssl JWT minting with the gh-token-minter image's CLI mode, which handles the same logic via ghpat_server.py. Signed-off-by: Swarup Ghosh <swghosh@redhat.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 983d1f0 commit eedaeff

1 file changed

Lines changed: 4 additions & 26 deletions

File tree

ci-operator/config/openshift-eng/oape-ai-e2e/openshift-eng-oape-ai-e2e-main.yaml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,37 +46,15 @@ tests:
4646
- as: mint-gh-token
4747
commands: |
4848
set -euo pipefail
49-
GH_APP_ID=$(cat /var/run/github-app/app-id)
50-
PEM_PATH="/var/run/github-app/private-key.pem"
51-
52-
HEADER=$(printf '{"alg":"RS256","typ":"JWT"}' | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
53-
NOW=$(date +%s)
54-
EXP=$((NOW + 300))
55-
PAYLOAD=$(printf '{"iat":%d,"exp":%d,"iss":"%s"}' "$NOW" "$EXP" "$GH_APP_ID" | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
56-
UNSIGNED="${HEADER}.${PAYLOAD}"
57-
SIGNATURE=$(printf '%s' "$UNSIGNED" | openssl dgst -sha256 -sign "$PEM_PATH" -binary | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
58-
JWT="${UNSIGNED}.${SIGNATURE}"
59-
60-
INST_ID=$(curl -sf \
61-
-H "Authorization: Bearer ${JWT}" \
62-
-H "Accept: application/vnd.github+json" \
63-
-H "X-GitHub-Api-Version: 2022-11-28" \
64-
https://api.github.com/app/installations \
65-
| python3 -c "import sys,json; print(json.load(sys.stdin)[0]['id'])")
66-
49+
export GH_APP_ID=$(cat /var/run/github-app/app-id)
50+
export GH_APP_PEM_FILE_PATH="/var/run/github-app/private-key.pem"
6751
set +x
68-
TOKEN=$(curl -sf -X POST \
69-
-H "Authorization: Bearer ${JWT}" \
70-
-H "Accept: application/vnd.github+json" \
71-
-H "X-GitHub-Api-Version: 2022-11-28" \
72-
"https://api.github.com/app/installations/${INST_ID}/access_tokens" \
73-
| python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
74-
echo "${TOKEN}" > "${SHARED_DIR}/gh-token"
52+
python /app/ghpat_server.py > "${SHARED_DIR}/gh-token"
7553
credentials:
7654
- mount_path: /var/run/github-app
7755
name: openshift-app-platform-shift-github-bot
7856
namespace: test-credentials
79-
from: agent-worker
57+
from: gh-token-minter
8058
resources:
8159
requests:
8260
cpu: 100m

0 commit comments

Comments
 (0)