5 Commits

Author SHA1 Message Date
kasun 37395e3a4d Merge pull request 'Bug/rework ci triggers' (#7) from bug/rework-ci-triggers into main
Deploy k8s Infra / Pulumi Preview (push) Has been skipped
Deploy k8s Infra / Pulumi Deploy (push) Successful in 54s
Reviewed-on: #7
2026-06-02 00:31:08 +02:00
kasun c8f606fd20 fix: removed auto-trigger on push. pipeline only triggered manually
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 58s
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Has been skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 32s
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Has been skipped
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 56s
Deploy k8s Infra / Pulumi Deploy (pull_request) Has been skipped
2026-06-02 00:25:35 +02:00
kasun cbcb829137 fix: removed auto-trigger on push. pipeline only triggered manually 2026-06-02 00:23:43 +02:00
kasun 64ef076350 Revert "Merge pull request 'fix: added shutdown logic to deployment yaml to speed up deployment runs' (#6) from bug/fix-long-deployments-because-of-started-vms into main"
Deploy Proxmox Infra / Pulumi Preview (push) Has been skipped
Deploy Proxmox Infra / Pulumi Deploy (push) Successful in 57s
Deploy k8s Infra / Pulumi Preview (push) Has been skipped
Deploy k8s Infra / Pulumi Deploy (push) Failing after 47s
This reverts commit f89822e4f7, reversing
changes made to 19af76fd2b.
2026-06-02 00:18:22 +02:00
kasun f89822e4f7 Merge pull request 'fix: added shutdown logic to deployment yaml to speed up deployment runs' (#6) from bug/fix-long-deployments-because-of-started-vms into main
Deploy Proxmox Infra / Pulumi Preview (push) Has been skipped
Deploy Proxmox Infra / Pulumi Deploy (push) Successful in 1m5s
Deploy k8s Infra / Pulumi Preview (push) Has been skipped
Deploy k8s Infra / Pulumi Deploy (push) Failing after 1m0s
Reviewed-on: #6
2026-06-01 22:40:07 +02:00
3 changed files with 11 additions and 64 deletions
+10 -55
View File
@@ -2,18 +2,13 @@ name: Deploy Proxmox Infra
on: on:
workflow_dispatch: workflow_dispatch:
push:
branches:
- main
paths:
- '01-proxmox-infra/**'
- '.gitea/workflows/**'
pull_request: pull_request:
branches: branches:
- main - main
paths: paths:
- '01-proxmox-infra/**' - "01-proxmox-infra/**"
- '.gitea/workflows/**' - ".gitea/workflows/**"
jobs: jobs:
preview: preview:
@@ -27,7 +22,7 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '24' node-version: "24"
- name: Restore Stack Config - name: Restore Stack Config
run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml
@@ -56,7 +51,7 @@ jobs:
deploy: deploy:
name: Pulumi Deploy name: Pulumi Deploy
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -64,7 +59,7 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '24' node-version: "24"
- name: Restore Stack Config - name: Restore Stack Config
run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml
@@ -80,57 +75,17 @@ jobs:
run: pulumi package add terraform-provider marshallford/pfsense 0.22.0 run: pulumi package add terraform-provider marshallford/pfsense 0.22.0
working-directory: 01-proxmox-infra working-directory: 01-proxmox-infra
- name: Shutdown VMs - name: Refresh State
run: | run: |
pulumi login "$PULUMI_BACKEND_URL" pulumi login "$PULUMI_BACKEND_URL"
PVE1=$(pulumi stack output --stack dev --show-secrets pve1Endpoint) pulumi refresh --yes --stack dev \
TOKEN1=$(pulumi stack output --stack dev --show-secrets pve1ApiToken) --target 'urn:pulumi:dev::proxmox-infra::proxmoxve*' \
PVE2=$(pulumi stack output --stack dev --show-secrets pve2Endpoint) --target 'urn:pulumi:dev::proxmox-infra::tls*'
TOKEN2=$(pulumi stack output --stack dev --show-secrets pve2ApiToken)
IDS=$(pulumi stack output --stack dev --json vmIds)
M1=$(echo "$IDS" | jq -r .master1)
M2=$(echo "$IDS" | jq -r .master2)
W1=$(echo "$IDS" | jq -r .worker1)
M3=$(echo "$IDS" | jq -r .master3)
W2=$(echo "$IDS" | jq -r .worker2)
for id in $M1 $M2 $W1; do
curl -sf -k -X POST "$PVE1/api2/json/nodes/pve/qemu/$id/status/shutdown" \
-H "Authorization: PVEAPIToken=$TOKEN1" || true
done
for id in $M3 $W2; do
curl -sf -k -X POST "$PVE2/api2/json/nodes/pve-bckp/qemu/$id/status/shutdown" \
-H "Authorization: PVEAPIToken=$TOKEN2" || true
done
wait_stopped() {
local ep=$1 tok=$2 node=$3 id=$4
for i in $(seq 1 36); do
status=$(curl -sf -k "$ep/api2/json/nodes/$node/qemu/$id/status/current" \
-H "Authorization: PVEAPIToken=$tok" | jq -r .data.status)
[ "$status" = "stopped" ] && return 0
sleep 5
done
echo "Timeout: VM $id did not stop within 3 minutes" && exit 1
}
for id in $M1 $M2 $W1; do wait_stopped "$PVE1" "$TOKEN1" pve "$id"; done
for id in $M3 $W2; do wait_stopped "$PVE2" "$TOKEN2" pve-bckp "$id"; done
working-directory: 01-proxmox-infra working-directory: 01-proxmox-infra
env: env:
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
PULUMI_BACKEND_URL: ${{ secrets.PULUMI_BACKEND_URL }} PULUMI_BACKEND_URL: ${{ secrets.PULUMI_BACKEND_URL }}
- name: Refresh State
uses: pulumi/actions@v5
with:
command: refresh
stack-name: dev
work-dir: 01-proxmox-infra
cloud-url: ${{ secrets.PULUMI_BACKEND_URL }}
env:
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
- name: Deploy - name: Deploy
uses: pulumi/actions@v5 uses: pulumi/actions@v5
with: with:
@@ -2,12 +2,6 @@ name: Deploy k8s Bootstrap
on: on:
workflow_dispatch: workflow_dispatch:
push:
branches:
- main
paths:
- "02-k8s-bootstrap/**"
- ".gitea/workflows/02-deploy-k8s-bootstrap.yaml"
pull_request: pull_request:
branches: branches:
- main - main
@@ -49,7 +43,7 @@ jobs:
deploy: deploy:
name: Bootstrap k3s Cluster name: Bootstrap k3s Cluster
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
-2
View File
@@ -16,11 +16,9 @@ npm install
pulumi preview pulumi preview
# Sync Pulumi state with actual Proxmox state (run before up if resources were changed manually) # Sync Pulumi state with actual Proxmox state (run before up if resources were changed manually)
# Note: shut down all k3s VMs in Proxmox first — refresh is slow against running VMs
pulumi refresh --yes pulumi refresh --yes
# Deploy infrastructure # Deploy infrastructure
# Note: shut down all k3s VMs in Proxmox first, then run:
pulumi refresh --yes && pulumi up --yes pulumi refresh --yes && pulumi up --yes
# Destroy infrastructure # Destroy infrastructure