Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nav_order: 9

### Changes

- `./test` validates the Butane configs in `butane/docs`, restoring coverage that was lost when Butane merged into this repository
- `./test` validates the Butane configs in `butane/docs` without needing a `butane` binary, restoring coverage that was lost when Butane merged into this repository

### Bug fixes

Expand Down
30 changes: 0 additions & 30 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,4 @@ for id in ${platforms}; do
esac
done

echo "Checking butane docs..."
BUTANE_BIN="${BIN_PATH:-bin}/butane"
if [ ! -x "${BUTANE_BIN}" ]; then
echo "butane binary not found at ${BUTANE_BIN}; run 'make butane' first" >&2
exit 1
fi
shopt -s nullglob
tmpdir=$(mktemp -d)
trap 'rm -rf "${butane_files_dir}" "${tmpdir}"' EXIT
# Create files-dir contents expected by example configs
mkdir -p "${tmpdir}/files-dir/tree"
touch "${tmpdir}/files-dir/"{config.ign,ca.pem,example.conf,example.service,file,file-epilogue,local-file3}
echo "ssh-rsa AAAA" > "${tmpdir}/files-dir/id_rsa.pub"
echo "ssh-ed25519 AAAA" > "${tmpdir}/files-dir/id_ed25519.pub"
echo '{"ignition": {"version": "3.5.0"}}' > "${tmpdir}/files-dir/ignition.ign"

for doc in butane/docs/*md; do
# Split each doc on the butane-config marker
sed -n '/^<!-- butane-config -->/,/^```$/ p' <"${doc}" \
| csplit - '/<!-- butane-config -->/' '{*}' -z --prefix "${tmpdir}/config_$(basename "${doc%.*}")_" -q
for cfg in "${tmpdir}"/config_*; do
echo "Checking ${doc}: $(basename "${cfg}")"
# Strip the marker + ```yaml header and the trailing ```
tail -n +3 "${cfg}" | head -n -1 \
| "${BUTANE_BIN}" --check --strict --files-dir "${tmpdir}/files-dir" \
|| (cat -n "${cfg}" && exit 1)
done
rm -f "${tmpdir}"/config_*
done

echo "Success"
Loading