Avoid duplicating packages in colcon Windows CI #186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DSL logs and checks | |
on: | |
pull_request: | |
paths: | |
# Can not restrict it to jenkins-scripts/dsl/** since there are sanity | |
# checks on generated XML done on removal/addition of scripts in jenkins-scripts | |
- 'jenkins-scripts/**' | |
jobs: | |
xml_generation: | |
runs-on: ubuntu-latest | |
name: Generate XML config from DSL | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Download and setup job dsl jar | |
run: ./jenkins-scripts/dsl/tools/setup_local_generation.bash | |
- name: Generate XML files | |
run: | | |
# Remove existing logs files. Code is adding content to them but not re-generating | |
# simulate token for brew_release | |
sudo mkdir -p /var/lib/jenkins/ && sudo touch /var/lib/jenkins/remote_token | |
sudo chown -R ${USER} /var/lib/jenkins | |
pushd jenkins-scripts/dsl | |
rm -fr logs && mkdir logs | |
WRITE_JOB_LOG=1 java -jar tools/jobdsl.jar *.dsl | |
find logs/* -exec sort {} -o {} \; | |
popd | |
- name: Checks for DSL Code | |
run: | | |
cd jenkins-scripts/dsl | |
./dsl_checks.bash | |
- name: Export XML generated configuration for diff | |
run: | | |
cd jenkins-scripts/dsl | |
# export files for later diff | |
mkdir /tmp/pr_xml_configuration | |
mv *.xml /tmp/pr_xml_configuration/ | |
- name: Update and commit logs generated | |
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5 sha | |
with: | |
file_pattern: jenkins-scripts/dsl/logs/ | |
commit_message: 'Automated change: update logs [skip ci]' | |
- name: Generate master DSL files | |
run: | | |
git clean -f -e jobdsl.jar | |
git checkout master | |
cd jenkins-scripts/dsl | |
WRITE_JOB_LOG=1 java -jar tools/jobdsl.jar *.dsl | |
mkdir /tmp/current_xml_configuration | |
mv *.xml /tmp/current_xml_configuration/ | |
- name: Generating diffs | |
run: | | |
# somehow the Jenkins views changed the portlet_ id on every run. | |
diff -qr -I '.*<id>dashboard_portlet_.*</id>.*' /tmp/current_xml_configuration /tmp/pr_xml_configuration | sort > /tmp/xml_config_files_changed.diff || true | |
diff -ur -I '.*<id>dashboard_portlet_.*</id>.*' /tmp/current_xml_configuration /tmp/pr_xml_configuration > /tmp/xml_config_content_changed.diff || true | |
- name: Archive files changes | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xml_config_files_changed | |
path: /tmp/xml_config_files_changed.diff | |
- name: Archive content changes | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xml_config_content_changed | |
path: /tmp/xml_config_content_changed.diff |