From a72a9f58d30b9c12982410d03a18198a8a9422b5 Mon Sep 17 00:00:00 2001 From: Colgrave Date: Sun, 5 Jan 2025 16:00:12 -0500 Subject: [PATCH] add Butane example --- Butane/.woodpecker.yaml | 24 ++++++++++++++++++++++++ Butane/script.sh | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Butane/.woodpecker.yaml create mode 100644 Butane/script.sh diff --git a/Butane/.woodpecker.yaml b/Butane/.woodpecker.yaml new file mode 100644 index 0000000..cb52594 --- /dev/null +++ b/Butane/.woodpecker.yaml @@ -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/ + - 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 diff --git a/Butane/script.sh b/Butane/script.sh new file mode 100644 index 0000000..55f00c1 --- /dev/null +++ b/Butane/script.sh @@ -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