Skip to content

Commit

Permalink
Feat!: Update JJB version to 6x
Browse files Browse the repository at this point in the history
Jenkins Job Builder 6.0.0 is released and breaks backward
compatibility with 5.1.0.

The breaking changes with previous 5.1.0 release:

- Jobs are now expanded the same way as job templates.
- Macros without parameters are now expanded the same way as macros
  with parameters.
- Tags !include-raw: and !include-raw-escape: should now be used the
  same way in jobs and macros without parameters as they are used in
  job templates and macros with parameters.
- Fix shellcheck warnings
Ref:
https://storyboard.openstack.org/#!/story/2010963
https://storyboard.openstack.org/#!/story/2010588

Issue: LF-JIRA RELENG-5119
Signed-off-by: Anil Belur <[email protected]>
Change-Id: I9c16d62bf40c1396a630b479dca12a62a6e48c56
Signed-off-by: Anil Belur <[email protected]>
  • Loading branch information
askb committed Feb 7, 2024
1 parent b55a8f2 commit 349cdbd
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 123 deletions.
2 changes: 1 addition & 1 deletion global-jjb
18 changes: 18 additions & 0 deletions jjb/autorelease/autorelease-checkout-gerrit-patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -l
set -eu -o pipefail

# If the project is autorelease then we do not need to cd
if [ "$GERRIT_PROJECT" != "releng/autorelease" ]; then
cd "$WORKSPACE/$GERRIT_PROJECT"
fi

echo "Checking out ${GERRIT_PROJECT} patch ${GERRIT_REFSPEC}..."
git fetch origin "${GERRIT_REFSPEC}" && git checkout FETCH_HEAD

# If the project is autorelease then we need to init and update submodules
if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
git submodule update --init
# The previous checkout might have failed to remove directory of a submodule being removed.
# See https://stackoverflow.com/a/10761699
git clean -dff
fi
32 changes: 7 additions & 25 deletions jjb/autorelease/autorelease-macros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,7 @@
- builder:
name: autorelease-checkout-gerrit-patch
builders:
- shell: |
#!/bin/bash -l
set -eu -o pipefail
# If the project is autorelease then we do not need to cd
if [ "$GERRIT_PROJECT" != "releng/autorelease" ]; then
cd "$WORKSPACE/$GERRIT_PROJECT"
fi
echo "Checking out ${GERRIT_PROJECT} patch ${GERRIT_REFSPEC}..."
git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
# If the project is autorelease then we need to init and update submodules
if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
git submodule update --init
# The previous checkout might have failed to remove directory of a submodule being removed.
# See https://stackoverflow.com/a/10761699
git clean -dff
fi
- shell: !include-raw-escape: autorelease-checkout-gerrit-patch.sh

- builder:
name: autorelease-determine-merge-order
Expand Down Expand Up @@ -103,14 +85,14 @@
- builder:
name: autorelease-generate-release-patches
builders:
- shell: !include-raw:
- shell: !include-raw-escape:
- prepare-release.sh

- builder:
name: autorelease-get-integration-test-variables
builders:
- integration-set-variables
- shell: !include-raw: autorelease-get-integration-test-variables.sh
- shell: !include-raw-escape: autorelease-get-integration-test-variables.sh
- inject:
properties-file: variables.prop

Expand All @@ -123,18 +105,18 @@
- builder:
name: autorelease-generate-release-notes
builders:
- shell: !include-raw:
- shell: !include-raw-escape:
- generate-release-notes.sh

- builder:
name: autorelease-update-project-views
builders:
- shell: !include-raw: update-autorelease-projects-views.sh
- shell: !include-raw-escape: update-autorelease-projects-views.sh

- builder:
name: autorelease-update-validate-projects
builders:
- shell: !include-raw: update-validate-autorelease-projects.sh
- shell: !include-raw-escape: update-validate-autorelease-projects.sh

- builder:
name: autorelease-compare-projects
Expand All @@ -155,5 +137,5 @@
- SUCCESS
- UNSTABLE
build-steps:
- shell: !include-raw: notify-build-failure.sh
- shell: !include-raw-escape: notify-build-failure.sh
mark-unstable-if-failed: true
2 changes: 1 addition & 1 deletion jjb/docs/docs-macros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- builder:
name: docs-update
builders:
- shell: !include-raw:
- shell: !include-raw-escape:
- docs_version_bump.sh
- docs_version_bump_projects.sh
28 changes: 28 additions & 0 deletions jjb/integration/distribution/distribution-check-verify-groupid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -l
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2024 The Linux Foundation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################

# This script performs version bumping activities for an ODL release.
echo "---> distribution-check-verify-groupid.sh"

echo "These are allowed projects: $ALLOW_PROJECTS"
echo "These are distribution pulled projects:"
EXIT_CODE="0"
for PROJECT in /tmp/r/org/opendaylight/*; do
if [[ ! -d "$PROJECT" ]]; then
continue
fi
echo "Checking $PROJECT"
if [[ "$ALLOW_PROJECTS" != *"$PROJECT"* ]]; then
echo "ERROR: Not allowed project $PROJECT pulled"
EXIT_CODE="1"
fi
done
exit $EXIT_CODE
39 changes: 39 additions & 0 deletions jjb/integration/distribution/distribution-check-wipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash -l
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2024 The Linux Foundation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################

# This script performs version bumping activities for an ODL release.
echo "---> distribution-check-wipe.sh"

echo "wipe r: the local Maven repository"
rm -rfv /tmp/r
echo "wipe n: the fake remote (Nexus) repository"
rm -rfv /tmp/n
echo "wipe t: the transient repository used in some manipulations"
rm -rfv /tmp/t
echo "create n: multithreaded execution might fail at creating it."
mkdir /tmp/n
echo "detecting distribution allowed projects"
# Some allowed projects cannot be detected in distribution because they do not produce features.
ALLOW_PROJECTS=(yangtools mdsal openflowjava)
if [[ "$KARAF_VERSION" == "odl" ]]; then
# shellcheck disable=SC2207
ALLOW_PROJECTS+=($(grep '<groupId>org.opendaylight.' -Rh distribution \
| sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
| sed -e 's%</groupId>%%' | sort -u))
else
# For Managed distro we only look at the features folder
# shellcheck disable=SC2207
ALLOW_PROJECTS+=($(grep '<groupId>org.opendaylight.' -Rh distribution/features \
| sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
| sed -e 's%</groupId>%%' | sort -u))
fi
echo "Allowed projects are " "${ALLOW_PROJECTS[@]}"
echo "ALLOW_PROJECTS= " "${ALLOW_PROJECTS[@]}" > allowed_projects.txt
46 changes: 3 additions & 43 deletions jjb/integration/distribution/distribution-macros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,7 @@
name: distribution-check-wipe
# Step zero: Wipe file repositories up front.
builders:
- shell: |
echo "wipe r: the local Maven repository"
rm -rfv /tmp/r
echo "wipe n: the fake remote (Nexus) repository"
rm -rfv /tmp/n
echo "wipe t: the transient repository used in some manipulations"
rm -rfv /tmp/t
echo "create n: multithreaded execution might fail at creating it."
mkdir /tmp/n
echo "detecting distribution allowed projects"
# Some allowed projects cannot be detected in distribution because they do not produce features.
ALLOW_PROJECTS=(yangtools mdsal openflowjava)
if [[ "$KARAF_VERSION" == "odl" ]]; then
ALLOW_PROJECTS+=(`grep '<groupId>org.opendaylight.' -Rh distribution \
| sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
| sed -e 's%</groupId>%%' | sort -u`)
else
# For Managed distro we only look at the features folder
ALLOW_PROJECTS+=(`grep '<groupId>org.opendaylight.' -Rh distribution/features \
| sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
| sed -e 's%</groupId>%%' | sort -u`)
fi
echo "Allowed projects are ${ALLOW_PROJECTS[@]}"
echo "ALLOW_PROJECTS=${ALLOW_PROJECTS[@]}" > allowed_projects.txt
- shell: !include-raw-escape: distribution-check-wipe.sh

- builder:
name: distribution-check-build-project
Expand Down Expand Up @@ -61,24 +38,7 @@
# Arguments:
# gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
builders:
- shell: |
echo "These are allowed projects: $ALLOW_PROJECTS"
echo "These are distribution pulled projects:"
EXIT_CODE="0"
for PROJECT in `ls /tmp/r/org/opendaylight`; do
echo "checking $PROJECT"
if [[ "$ALLOW_PROJECTS" != *"$PROJECT"* ]]; then
echo "ERROR: Not allowed project $PROJECT pulled"
EXIT_CODE="1"
fi
done
exit $EXIT_CODE
echo "verify project groupId"
mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
rm -rf /tmp/n
mv /tmp/t /tmp/n
- shell: !include-raw-escape: distribution-check-verify-groupid.sh

- builder:
name: distribution-check-download-deps
Expand Down Expand Up @@ -277,4 +237,4 @@
# KARAF_VERSION: 'karaf4' or 'karaf3'.
# Use distribution-karaf-version macro to customize.
builders:
- shell: !include-raw: distribution-check-bootup.sh
- shell: !include-raw-escape: distribution-check-bootup.sh
8 changes: 6 additions & 2 deletions jjb/integration/distribution/distribution-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
name: "distribution-verify-{type}-{stream}"

disable-job: "false"
jacoco-exclude-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"

project-type: freestyle
node: centos8-builder-8c-8g
Expand Down Expand Up @@ -193,7 +194,8 @@

publishers:
- findbugs
- lf-jacoco-report
- lf-jacoco-report:
exclude-pattern: { jacoco-exclude-pattern }
- lf-infra-publish
- email-notification:
email-recipients: "{email-recipients}"
Expand All @@ -208,6 +210,7 @@
# https://issues.apache.org/jira/browse/MNG-5666

disable-job: false
jacoco-exclude-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"

project-type: maven
node: "centos8-builder-8c-8g"
Expand Down Expand Up @@ -287,7 +290,8 @@
id: ""
unique-version: true
deploy-unstable: false
- lf-jacoco-report
- lf-jacoco-report:
exclude-pattern: "{jacoco-exclude-pattern}"
- lf-infra-publish
- email-notification:
email-recipients: "{email-recipients}"
Expand Down
21 changes: 21 additions & 0 deletions jjb/integration/integration-csit-archive-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo "Archiving csit artifacts"
cd "$WORKSPACE" || exit
mkdir -p ./archives
for i in $(seq 1 "${NUM_ODL_SYSTEM}"); do
NODE_FOLDER="./archives/odl_${i}"
mkdir -p "${NODE_FOLDER}"
mv odl"${i}"_* "${NODE_FOLDER}" || true
mv karaf_"${i}"_*_threads* "${NODE_FOLDER}" || true
mv -- *_"${i}".png "${NODE_FOLDER}" || true
mv /tmp/odl"${i}"_* "${NODE_FOLDER}" || true
mv gclogs-"${i}" "${NODE_FOLDER}" || true
done
curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
unzip -d ./archives robot-plugin.zip
mv -- *.log *.log.gz *.csv *.png ./archives || true # Don't fail if file missing
# TODO: Can the following line ever fail?
find . -type f -name '*.hprof' -print0 \
| tar -cvf - --null -T - | xz --threads=0 > ./archives/hprof.tar.xz
# TODO: Tweak the compression level if better ratio (or speed) is needed.
13 changes: 13 additions & 0 deletions jjb/integration/integration-csit-run-postscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#The following script runs any configurable postplan stored in test/csit/postplans.
if [ -f "${WORKSPACE}/test/csit/postplans/${TESTPLAN}" ]; then
echo "postplan exists!!!"
echo "Changing the postplan path..."
script_name=${WORKSPACE}/test/csit/postplans/${TESTPLAN}
sed "s:integration:${WORKSPACE}:" "${script_name}" > postplan.txt
cat postplan.txt
grep -Ev '(^[[:space:]]*#|^[[:space:]]*$)' postplan.txt | while read -r line ; do
echo "Executing ${line}..."
${line}
done
fi
Loading

0 comments on commit 349cdbd

Please sign in to comment.