mirror of
https://codeberg.org/Codeberg-CI/examples.git
synced 2025-09-17 07:45:04 -04:00
add Butane example
This commit is contained in:
parent
cf6b783a3d
commit
a72a9f58d3
24
Butane/.woodpecker.yaml
Normal file
24
Butane/.woodpecker.yaml
Normal 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
16
Butane/script.sh
Normal 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
|
Loading…
x
Reference in New Issue
Block a user