buildPacker
This commit is contained in:
@ -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
|
||||
- name: Build image
|
||||
working-directory: ./ubuntu-packer
|
||||
run: |
|
||||
packer build ubuntu.pkr.hcl
|
Reference in New Issue
Block a user