debug
Some checks failed
tofu plan k8s-wheatley / tofu-plan-k8s-wheatley (pull_request) Failing after 21s

This commit is contained in:
Peter 2026-02-18 18:31:09 +01:00
parent 1b4f09d412
commit 647b249d4e
Signed by: Peter
SSH key fingerprint: SHA256:B5tYaxBExaDm74r1px9iVeZ6F/ZDiyiy9SbBqfZYrvg

View file

@ -53,85 +53,64 @@ jobs:
run: tofu plan -no-color run: tofu plan -no-color
continue-on-error: true continue-on-error: true
- name: Fetch existing comments - name: debug
id: fetch run:
run: | cat <<'EOF'
set -euxo pipefail ${{ toJSON(forge) }}
EOF
echo "PR_NUMBER: $PR_NUMBER" # - name: Fetch existing comments
echo "Forgejo URL: ${{ forge.server_url }}" # id: fetch
echo "Repo: ${{ forge.repository }}" # run: |
# response=$(curl -s \
url="${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" # -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
# "${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
echo "Requesting: $url" #
# comment_id=$(echo "$response" | jq -r \
response=$(curl -sS -w "\nHTTP_STATUS:%{http_code}\n" \ # '.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \ #
"$url") # if [ -z $comment_id ]; then
# echo "Unable to fetch comment."
http_status=$(echo "$response" | sed -n 's/HTTP_STATUS://p') # exit 1
body=$(echo "$response" | sed '/HTTP_STATUS:/d') # fi
#
echo "HTTP status: $http_status" # echo "comment_id=$comment_id"
#
if [ "$http_status" != "200" ]; then # - name: Upsert comment
echo "Forgejo API call failed" # id: comment
exit 1 # env:
fi # COMMENT_BODY: |
# `#### OpenTofu Format and Style 🖌\`${{ steps.fmt.outcome }}\`
echo "Parsing JSON…" # #### OpenTofu Initialization ⚙️\`${{ steps.init.outcome }}\`
# #### OpenTofu Validation 🤖\`${{ steps.validate.outcome }}\`
echo "$body" | jq . # <details><summary>Validation Output</summary>
#
comment_id=$(echo "$body" | jq -r \ # \`\`\`\n
'.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1) # ${{ steps.validate.outputs.stdout }}
# \`\`\`
echo "Matched comment_id: '$comment_id'" #
# </details>
if [ -z "$comment_id" ] || [ "$comment_id" = "null" ]; then #
echo "No existing comment found matching marker" # #### OpenTofu Plan 📖\`${{ steps.plan.outcome }}\`
exit 1 #
fi # <details><summary>Show Plan</summary>
#
echo "Found comment id: $comment_id" # \`\`\`\n
echo "comment_id=$comment_id" >> "$GITHUB_OUTPUT" # ${process.env.PLAN}
# \`\`\`
- name: Upsert comment #
id: comment # </details>
env: # run: |
COMMENT_BODY: | # if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then
`#### OpenTofu Format and Style 🖌\`${{ steps.fmt.outcome }}\` # curl -s -X PATCH \
#### OpenTofu Initialization ⚙️\`${{ steps.init.outcome }}\` # -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
#### OpenTofu Validation 🤖\`${{ steps.validate.outcome }}\` # -H "Content-Type: application/json" \
<details><summary>Validation Output</summary> # "${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/comments/${{ steps.fetch.outputs.comment_id }}" \
# -d "{\"body\":\"$COMMENT_BODY\"}"
\`\`\`\n # else
${{ steps.validate.outputs.stdout }} # curl -s -X POST \
\`\`\` # -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
# -H "Content-Type: application/json" \
</details> # "${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
# -d "{\"body\":\"$COMMENT_BODY\"}"
#### OpenTofu Plan 📖\`${{ steps.plan.outcome }}\` # fi
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
run: |
if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then
curl -s -X PATCH \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/comments/${{ steps.fetch.outputs.comment_id }}" \
-d "{\"body\":\"$COMMENT_BODY\"}"
else
curl -s -X POST \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
-d "{\"body\":\"$COMMENT_BODY\"}"
fi