big update
This commit is contained in:
@@ -6,38 +6,60 @@ on:
|
||||
description: "The URL endpoint for the Proxmox API"
|
||||
type: string
|
||||
default: "https://212.3.125.242:8006/"
|
||||
infisical_api_url:
|
||||
description: "Infisical API URL (for self-hosted instances)"
|
||||
type: string
|
||||
required: false
|
||||
default: "https://secrets.itlab-ffeks.dnu.edu.ua"
|
||||
secrets:
|
||||
PROXMOX_VE_API_TOKEN:
|
||||
description: "The API token for Proxmox authentication"
|
||||
required: true
|
||||
INFRASTRUCTURE_TOKEN:
|
||||
description: "Gitea Auth Token"
|
||||
infisical_cicd_token:
|
||||
description: "Infisical Service Token for CI/CD secrets"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
deploy-to-proxmox:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# Proxmox Auth (Endpoint from inputs, Token from explicit secrets)
|
||||
# Proxmox Auth (Endpoint from inputs)
|
||||
PROXMOX_VE_ENDPOINT: ${{ inputs.proxmox_endpoint }}
|
||||
PROXMOX_VE_API_TOKEN: ${{ secrets.PROXMOX_VE_API_TOKEN }}
|
||||
PROXMOX_VE_INSECURE: "true"
|
||||
|
||||
# Gitea Remote State Backend (Dynamic per-repository package)
|
||||
TF_HTTP_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}"
|
||||
TF_HTTP_LOCK_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}/lock"
|
||||
TF_HTTP_UNLOCK_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}/lock"
|
||||
# Gitea Remote State Backend (Dynamic per-repository package/workspace)
|
||||
TF_HTTP_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}-${{ gitea.ref_name }}"
|
||||
TF_HTTP_LOCK_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}-${{ gitea.ref_name }}/lock"
|
||||
TF_HTTP_UNLOCK_ADDRESS: "https://git.itlab-ffeks.dnu.edu.ua/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}-${{ gitea.ref_name }}/lock"
|
||||
TF_HTTP_LOCK_METHOD: "POST"
|
||||
TF_HTTP_UNLOCK_METHOD: "DELETE"
|
||||
TF_HTTP_USERNAME: ${{ gitea.actor }}
|
||||
TF_HTTP_PASSWORD: ${{ secrets.INFRASTRUCTURE_TOKEN }}
|
||||
TF_VAR_environment: ${{ gitea.ref_name }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Fetch secrets from Infisical
|
||||
run: |
|
||||
export INFISICAL_TOKEN="${{ secrets.infisical_cicd_token }}"
|
||||
export INFISICAL_API_URL="${{ inputs.infisical_api_url || 'https://app.infisical.com' }}"
|
||||
export INFISICAL_DOMAIN="$INFISICAL_API_URL"
|
||||
export INFISICAL_DISABLE_UPDATE_CHECK=true
|
||||
|
||||
# Fetch secrets (assuming CLI is pre-installed)
|
||||
echo "Fetching secrets from Infisical..."
|
||||
PROXMOX_VE_API_TOKEN=$(infisical secrets get PROXMOX_VE_API_TOKEN --plain)
|
||||
INFRASTRUCTURE_TOKEN=$(infisical secrets get INFRASTRUCTURE_TOKEN --plain)
|
||||
|
||||
# Mask values in logs immediately
|
||||
echo "::add-mask::$PROXMOX_VE_API_TOKEN"
|
||||
echo "::add-mask::$INFRASTRUCTURE_TOKEN"
|
||||
|
||||
# Export to GITHUB_ENV for subsequent steps/env context
|
||||
echo "PROXMOX_VE_API_TOKEN=$PROXMOX_VE_API_TOKEN" >> $GITHUB_ENV
|
||||
echo "INFRASTRUCTURE_TOKEN=$INFRASTRUCTURE_TOKEN" >> $GITHUB_ENV
|
||||
echo "TF_HTTP_PASSWORD=$INFRASTRUCTURE_TOKEN" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure Git for private modules
|
||||
run: git config --global url."https://oauth2:${{ secrets.INFRASTRUCTURE_TOKEN }}@git.itlab-ffeks.dnu.edu.ua".insteadOf "https://git.itlab-ffeks.dnu.edu.ua"
|
||||
run: git config --global url."https://oauth2:$INFRASTRUCTURE_TOKEN@git.itlab-ffeks.dnu.edu.ua".insteadOf "https://git.itlab-ffeks.dnu.edu.ua"
|
||||
|
||||
- name: Setup OpenTofu
|
||||
uses: opentofu/setup-opentofu@v1
|
||||
|
||||
Reference in New Issue
Block a user