From 10f6e5e735214186faf5618f5ca38c8a620ee98a Mon Sep 17 00:00:00 2001 From: "martin.cholewa" Date: Fri, 20 Jun 2025 11:41:32 +0200 Subject: [PATCH] buildPacker --- .gitea/workflows/packer.yaml | 39 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/packer.yaml b/.gitea/workflows/packer.yaml index 9fffa68..d3aabaf 100644 --- a/.gitea/workflows/packer.yaml +++ b/.gitea/workflows/packer.yaml @@ -1,33 +1,28 @@ -name: Check Certificates Expiry +name: Build Ubuntu Image on: workflow_dispatch: jobs: - check_certs: + packer-build: runs-on: ubuntu-latest steps: - - name: Display certificate expiry dates + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Change to packer directory + working-directory: ./ubuntu-packer run: | - for host in chosesoft.eu nas.chosesoft.eu gitea.chosesoft.eu; do - echo "🔍 Certificate for $host:" - expiry_date=$(echo | openssl s_client -servername "$host" -connect "$host:443" 2>/dev/null \ - | openssl x509 -noout -enddate | cut -d= -f2) + echo "Working dir: $(pwd)" + ls -la - if [ -z "$expiry_date" ]; then - echo "❌ Unable to fetch certificate for $host" - echo - continue - fi + - name: Init Packer + working-directory: ./ubuntu-packer + run: | + packer init . - expiry_ts=$(date -d "$expiry_date" +%s) - now_ts=$(date +%s) - - if [ "$expiry_ts" -gt "$now_ts" ]; then - echo "✅ Valid until: $expiry_date" - else - echo "❌ Expired on: $expiry_date" - fi - echo - done \ No newline at end of file + - name: Build image + working-directory: ./ubuntu-packer + run: | + packer build ubuntu.pkr.hcl \ No newline at end of file