Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move github actions dsl checks to a script #1042

Merged
merged 3 commits into from
Oct 17, 2023
Merged
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
22 changes: 2 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,11 @@ jobs:
sudo chown -R ${USER} /var/lib/jenkins
cd jenkins-scripts/dsl
WRITE_JOB_LOG=1 java -jar tools/jobdsl.jar *.dsl
- name: Checks for abichecker jobs
- name: Checks for DSL Code
if: steps.dsl_check.outputs.run_job == 'true'
run: |
cd jenkins-scripts/dsl
main=$(grep '<branch>main</branch>' *-abichecker-*.xml || true)
if [[ -n ${main} ]]; then
echo "Found a main branch in an abichecker job:"
echo "${main}"
echo "Main branches are not target of abichecking. Fix the code."
exit 1
fi
# Filter out the previous auto jobs
mkdir /tmp/abichecker_filtered_jobs
cp *-abichecker-*.xml /tmp/abichecker_filtered_jobs
cd /tmp/abichecker_filtered_jobs
rm *ubuntu_auto*.xml
repeated=$(grep '\<branch>' *-abichecker-*.xml | awk '{ print $2 }' | sort | uniq -d)
if [[ -n ${repeated} ]]; then
echo "Found a duplicate in an abichecker branch:"
echo "${repeated}"
echo "please exclude one of the versions in the yaml file to reduce the server workload"
exit 1
fi
./dsl_checks.bash
- name: Export XML generated configuration for diff
if: steps.dsl_check.outputs.run_job == 'true'
run: |
Expand Down
34 changes: 34 additions & 0 deletions jenkins-scripts/dsl/dsl_checks.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -e
#
if [[ -z $(ls -- *.xml) ]]; then
echo "No .xml file founds. Generate them using:"
echo "https://github.com/gazebo-tooling/release-tools/blob/master/jenkins-scripts/README.md#L11"
fi

not_null=$(grep 'null' -- *.xml || true)
if [[ -n ${not_null} ]]; then
echo "Found a null value in a configuration file:"
echo "${not_null}"
echo "Probably a problem in the code"
exit 1
fi

main=$(grep '<branch>main</branch>' -- *-abichecker-*.xml || true)
if [[ -n ${main} ]]; then
echo "Found a main branch in an abichecker job:"
echo "${main}"
echo "Main branches are not target of abichecking. Fix the code."
exit 1
fi

# Filter out the previous auto jobs
filtered_dir=$(mktemp -d)
cp -- *-abichecker-*.xml "${filtered_dir}"
rm -f "${filtered_dir}"/*-ubuntu_auto*.xml
repeated=$(grep '\<branch>' "${filtered_dir}"/*-abichecker-*.xml | awk '{ print $2 }' | sort | uniq -d)
if [[ -n ${repeated} ]]; then
echo "Found a duplicate in an abichecker branch:"
echo "${repeated}"
echo "please exclude one of the versions in the yaml file to reduce the server workload"
exit 1
fi