2025-11-28 15:34:52 +01:00
|
|
|
---
|
2025-11-28 20:53:52 +01:00
|
|
|
name: tofu plan k8s-wheatley
|
2025-11-28 15:34:52 +01:00
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
workflow_call:
|
|
|
|
|
pull_request:
|
|
|
|
|
branches:
|
|
|
|
|
- main
|
2026-02-18 12:54:32 +01:00
|
|
|
paths:
|
|
|
|
|
- pve01.wheatley.in/k8s-wheatley/**
|
2026-02-18 13:59:13 +01:00
|
|
|
- .forgejo/workflows/tofu-plan-k8s-wheatley.yaml
|
2025-11-29 11:15:28 +01:00
|
|
|
|
2025-11-28 15:34:52 +01:00
|
|
|
jobs:
|
2025-11-28 20:53:52 +01:00
|
|
|
tofu-plan-k8s-wheatley:
|
2025-11-28 15:34:52 +01:00
|
|
|
runs-on: docker
|
2026-01-19 15:35:38 +01:00
|
|
|
defaults:
|
|
|
|
|
run:
|
2026-02-18 12:54:32 +01:00
|
|
|
working-directory: pve01.wheatley.in/k8s-wheatley
|
2026-01-19 15:35:38 +01:00
|
|
|
permissions:
|
|
|
|
|
pull-requests: write
|
2026-02-18 13:43:17 +01:00
|
|
|
env:
|
|
|
|
|
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
|
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
2026-02-18 13:47:39 +01:00
|
|
|
TF_VAR_proxmox_endpoint: ${{ secrets.PROXMOX_ENDPOINT }}
|
|
|
|
|
TF_VAR_proxmox_api_token: ${{ secrets.PROXMOX_API_TOKEN }}
|
2026-02-18 16:52:11 +01:00
|
|
|
PR_NUMBER: ${{ forge.event.pull_request.number }}
|
2025-11-28 15:34:52 +01:00
|
|
|
steps:
|
2026-02-18 13:59:13 +01:00
|
|
|
- uses: https://github.com/actions/checkout@v4
|
|
|
|
|
- uses: https://github.com/opentofu/setup-opentofu@v1
|
|
|
|
|
with:
|
|
|
|
|
tofu_version: 1.11.5
|
2026-02-18 12:43:31 +01:00
|
|
|
|
2026-02-18 17:01:23 +01:00
|
|
|
- name: Install deps
|
|
|
|
|
run: |
|
2026-02-18 17:16:46 +01:00
|
|
|
apt update
|
2026-02-18 17:01:23 +01:00
|
|
|
apt install -y jq
|
|
|
|
|
|
2026-02-18 13:59:13 +01:00
|
|
|
- name: OpenTofu Init
|
|
|
|
|
id: init
|
|
|
|
|
run: tofu init --upgrade
|
2025-11-29 12:15:12 +01:00
|
|
|
|
2026-02-18 13:59:13 +01:00
|
|
|
- name: OpenTofu Format
|
|
|
|
|
id: fmt
|
|
|
|
|
run: tofu fmt -check
|
2025-11-28 15:34:52 +01:00
|
|
|
|
2026-02-18 13:59:13 +01:00
|
|
|
- name: OpenTofu Validate
|
|
|
|
|
id: validate
|
|
|
|
|
run: tofu validate -no-color
|
2025-11-28 15:34:52 +01:00
|
|
|
|
2026-02-18 13:59:13 +01:00
|
|
|
- name: OpenTofu Plan
|
|
|
|
|
id: plan
|
|
|
|
|
run: tofu plan -no-color
|
|
|
|
|
continue-on-error: true
|
2026-02-18 16:52:11 +01:00
|
|
|
|
2026-02-18 18:31:09 +01:00
|
|
|
- name: debug
|
|
|
|
|
run:
|
2026-02-18 18:32:20 +01:00
|
|
|
echo "${{ toJSON(forge) }}"
|
2026-02-18 18:31:09 +01:00
|
|
|
|
|
|
|
|
# - name: Fetch existing comments
|
|
|
|
|
# id: fetch
|
|
|
|
|
# run: |
|
|
|
|
|
# response=$(curl -s \
|
|
|
|
|
# -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
|
|
|
|
|
# "${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
|
|
|
|
|
#
|
|
|
|
|
# comment_id=$(echo "$response" | jq -r \
|
|
|
|
|
# '.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
|
|
|
|
|
#
|
|
|
|
|
# if [ -z $comment_id ]; then
|
|
|
|
|
# echo "Unable to fetch comment."
|
|
|
|
|
# exit 1
|
|
|
|
|
# fi
|
|
|
|
|
#
|
|
|
|
|
# echo "comment_id=$comment_id"
|
|
|
|
|
#
|
|
|
|
|
# - name: Upsert comment
|
|
|
|
|
# id: comment
|
|
|
|
|
# env:
|
|
|
|
|
# COMMENT_BODY: |
|
|
|
|
|
# `#### OpenTofu Format and Style 🖌\`${{ steps.fmt.outcome }}\`
|
|
|
|
|
# #### OpenTofu Initialization ⚙️\`${{ steps.init.outcome }}\`
|
|
|
|
|
# #### OpenTofu Validation 🤖\`${{ steps.validate.outcome }}\`
|
|
|
|
|
# <details><summary>Validation Output</summary>
|
|
|
|
|
#
|
|
|
|
|
# \`\`\`\n
|
|
|
|
|
# ${{ steps.validate.outputs.stdout }}
|
|
|
|
|
# \`\`\`
|
|
|
|
|
#
|
|
|
|
|
# </details>
|
|
|
|
|
#
|
|
|
|
|
# #### OpenTofu Plan 📖\`${{ steps.plan.outcome }}\`
|
|
|
|
|
#
|
|
|
|
|
# <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
|