Skip to content

Commit

Permalink
Merge branch 'master' into Crola1702/improve-outdatedjob-strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Crola1702 authored Dec 19, 2023
2 parents f5e36ff + 74203cf commit d81ca34
Show file tree
Hide file tree
Showing 15 changed files with 916 additions and 828 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci-dsl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: DSL logs and checks

on:
pull_request:
paths:
- 'jenkins-scripts/dsl/**'

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@v3
with:
name: xml_config_files_changed
path: /tmp/xml_config_files_changed.diff
- name: Archive content changes
uses: actions/upload-artifact@v3
with:
name: xml_config_content_changed
path: /tmp/xml_config_content_changed.diff
18 changes: 18 additions & 0 deletions .github/workflows/ci-releasepy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Releasing tests

on:
push:
paths:
- release.py

jobs:
dsl_ci:
runs-on: ubuntu-latest
name: release.py checks
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run release.py script tests
run: ./check_releasepy.bash
107 changes: 0 additions & 107 deletions .github/workflows/ci.yaml

This file was deleted.

1 change: 1 addition & 0 deletions check_releasepy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
test_dir=$(mktemp -d)
mkdir -p ${test_dir}/{focal,jammy,ubuntu}/debian
export _RELEASEPY_TEST_RELEASE_REPO=${test_dir}
export _RELEASEPY_DEBUG=1

exec_releasepy_test()
{
Expand Down
9 changes: 9 additions & 0 deletions jenkins-scripts/dsl/_configs_/GenericAnyJobGitHub.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import javaposse.jobdsl.dsl.Job

/*
Implements:
- priority 200
- parameters: SRC_REPO, SRC_BRANCH, JOB_DESCRIPTION
- job.Description
- scm check with SRC_REPO + SRC_BRANCH
Expand Down Expand Up @@ -33,6 +34,14 @@ class GenericAnyJobGitHub

job.with
{
// Overrwrite the priority set by other classes
configure { project ->
project / 'properties' / 'jenkins.advancedqueue.priority.strategy.PriorityJobProperty' {
'useJobPriority'(true)
'priority'(200)
}
}

parameters
{
stringParam('sha1', 'main', 'commit or refname to build. To manually use a branch: origin/$branch_name')
Expand Down
4 changes: 2 additions & 2 deletions jenkins-scripts/dsl/_configs_/OSRFLinuxABIGitHub.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import javaposse.jobdsl.dsl.Job
-> OSRFLinuxBase
Implements:
- priority 300
- priority 200
- logrotator
- concurrent builds
- parameter: DEST_BRANCH, SRC_BRANCH
Expand Down Expand Up @@ -35,7 +35,7 @@ class OSRFLinuxABIGitHub
job.with
{
properties {
priority 300
priority 200
}

logRotator {
Expand Down
22 changes: 12 additions & 10 deletions jenkins-scripts/dsl/dsl_checks.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ if [[ -n ${non_github_orgs} ]]; then
exit 1
fi

# re-enable after https://github.com/gazebo-tooling/release-tools/issues/1095

# 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
# 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
Loading

0 comments on commit d81ca34

Please sign in to comment.