Butane example (#66)

This PR add an example to translate all Butane config in directory to Ignition config with a simple bash script.

Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/66
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: Colgrave <hanqixu@disroot.org>
Co-committed-by: Colgrave <hanqixu@disroot.org>
This commit is contained in:
Colgrave 2025-01-08 17:31:59 +00:00 committed by Patrick Schratz
parent cf6b783a3d
commit 472428a7ce
4 changed files with 45 additions and 0 deletions

View File

@ -10,6 +10,7 @@ steps:
depends_on: []
image: woodpeckerci/woodpecker-cli:v2.8.2-alpine
commands:
- woodpecker-cli lint Butane/.woodpecker/butane.yaml
- woodpecker-cli lint C/
- woodpecker-cli lint Docker/
- woodpecker-cli lint Golang/

View File

@ -0,0 +1,27 @@
# butane.yaml
#
# Use a bash script to translate the Butane configs in the current directory to
# the Ignition configs, and push them to the master branch.
#
# [Butane](https://coreos.github.io/butane/)
# [Ignition](https://coreos.github.io/ignition/)
#
# [drone-git-push](https://github.com/appleboy/drone-git-push)
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/appleboy/drone-git-push
settings:
ssh_key:
from_secret: ssh_key
remote: git@codeberg.org:<YOUR_GIT_REPO>.git
branch: main

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

View File

@ -5,6 +5,7 @@ Pull requests are welcome!
| Link | Language | Build System | Comments |
| :--------------------------------------------------------------------------- | :---------- | :------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Butane/.woodpecker/butane.yaml](Butane/.woodpecker/butane.yaml) | Bash | --- | Translate Butane configs into Ignition configs with a simple bash script. |
| [C/.woodpecker/make.yaml](C/.woodpecker/make.yaml) | C | Make | Simple ci for building a Make based C project |
| [C/.woodpecker/meson.yaml](C/.woodpecker/meson.yaml) | C/C++ | meson | CI for meson-based projects. |
| [C/.woodpecker/meson-android.yaml](C/.woodpecker/meson-android.yaml) | C/C++ | meson + Android NDK | CI for meson-based projects cross-compiling to Android NDK. |