Commit d71db816 authored by Guillaume Abrioux's avatar Guillaume Abrioux
Browse files

workflow: add group_vars/defaults checks

let's use github workflow for checking defaults values.
Signed-off-by: default avatarGuillaume Abrioux <>
parent 5ed423ad
name: defaults
on: [pull_request]
runs-on: ubuntu-latest
- uses: actions/checkout@v2
fetch-depth: 0
- run: "${GITHUB_WORKSPACE}/tests/scripts/workflows/"
\ No newline at end of file
set -ex
function git_diff_to_head {
git diff --diff-filter=MT --no-color origin/"${GITHUB_BASE_REF}"..HEAD
function match_file {
git_diff_to_head | sed -n "s|^+++.*\\($1.*\\)|\\1|p"
# group_vars / defaults
match_file "/defaults/main.yml"
nb=$(match_file "/defaults/main.yml" | wc -l)
if [[ "$nb" -eq 0 ]]; then
echo "group_vars has not been touched."
match_file "group_vars/"
nb_group_vars=$(match_file "group_vars/" | wc -l)
if [[ "$nb" -gt "$nb_group_vars" ]]; then
echo "One or more files containing default variables has/have been modified."
echo "You must run '' to generate the group_vars template files."
exit 1
# ceph_release_num[ceph_release] statements check
if match_file "roles/ceph-defaults/" | grep -E '^[<>+].*- ceph_release_num\[ceph_release\]'; then
echo "Do not use statements like '- ceph_release_num[ceph_release]' in ceph-defaults role!"
echo "'ceph_release' is only populated **after** the play of ceph-defaults, typically in ceph-common or ceph-docker-common."
exit 1
echo "No '- ceph_release_num[ceph_release]' statements found in ceph-defaults role!"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment