add Butane example

This commit is contained in:
Colgrave 2025-01-05 16:00:12 -05:00
parent cf6b783a3d
commit a72a9f58d3
2 changed files with 40 additions and 0 deletions

24
Butane/.woodpecker.yaml Normal file
View File

@ -0,0 +1,24 @@
when:
branch: main
event: [ push, pull_request ]
steps:
- name: build
image: quay.io/coreos/butane:release
commands:
- bash ./script.sh
- name: push
image: docker.io/alpine/git:latest
environment:
MAIL:
from_secret: mail
CODEBERG_TOKEN:
from_secret: codeberg_token
commands:
- git remote set-url origin https://$CODEBERG_TOKEN@codeberg.org/<YOUR_GIT_REPO>
- git config user.email $MAIL
- git config user.name "Woodpecker CI"
- git add .
- git commit -m "CI translate Butane to Ignition files [SKIP CI]"
- git push origin main

16
Butane/script.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# loop through all butane files in the current directory
for i in *.bu ; do
# extract filename without extension
name=${i%.bu}
# use butane to convert the YAML file into an Ignition configuration
butane -ps ${i} -o ${name}.ign
if [ $? -eq 0 ]; then
echo "Converted ${i} to ${name}.ign successfully"
else
echo "Error converting ${i}"
fi
done