2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 # This script performs version bumping activities for an ODL release and branch
14 echo "---> version-bump.sh"
16 # The only purpose of RELEASE_TAG in this script is to set the Gerrit topic.
17 # It is also used as a placeholder for version bumping but gets wiped out
18 # immediately to bump versions by x.y.(z+1).
19 TOPIC="${RELEASE_TAG}"
20 RELEASE_TAG="${STREAM^}"
22 mkdir -p "$WORKSPACE/archives"
23 LOG_FILE="$WORKSPACE/archives/version-bump.log"
24 BRANCH="$GERRIT_BRANCH"
26 # Ensure we fail the job if any steps fail.
29 pip install --user --quiet --upgrade git-review
31 # Fail if branch cutting is not on master
32 if [ "$BRANCH_CUT" = "true" ] && [ "$BRANCH" != "master" ]; then
33 echo "ERROR: Cannot branch cut on $BRANCH, its required to be on the master branch."
37 if [ "$BRANCH_CUT" = "false" ]; then
38 git checkout -b "${BRANCH,,}" "origin/${BRANCH,,}"
40 for module in $(git submodule | awk '{ print $2 }')
43 git checkout -b "${BRANCH,,}" "origin/${BRANCH,,}"
48 # Setup Gerrit remote to ensure Change-Id gets set on commit.
49 git config --global --add gitreview.username "jenkins-$SILO"
52 git submodule foreach "git review -s"
54 # Check if git state is clean
57 if [ "$BRANCH_CUT" = "false" ]; then
58 lftools version release "$RELEASE_TAG"
60 lftools version bump "$RELEASE_TAG"
62 # Ignore changes to Final distribution since that will be released separately
63 pushd integration/distribution || true
64 git checkout -f opendaylight/pom.xml || true
67 git submodule foreach "git commit -asm 'Bump versions by x.y.(z+1)'"
68 # Only submodules need to be bumped, we can ignore autorelease's bump information
71 # Generate git patches
72 patch_dir="$WORKSPACE/archives/patches/version-bump"
74 for module in $(git submodule | awk '{ print $2 }')
77 git format-patch --stdout "origin/${BRANCH,,}" > "$patch_dir/${module//\//-}.patch"
78 git bundle create "$patch_dir/${module//\//-}.bundle" "origin/${BRANCH,,}..HEAD"
87 echo "----> Verify version bump"
88 git submodule foreach git show HEAD
90 find . -name pom.xml -print0 | xargs -0 grep "$RELEASE_TAG" || true
93 } | tee -a "$LOG_FILE"
99 MVN_GOALS=(clean install)
100 if [ "$DRY_RUN" = "false" ]
102 # Should be safe to run mvn clean deploy as nothing should be
103 # using the version bumped versions just yet.
104 MVN_GOALS=(clean deploy)
107 ./scripts/fix-relativepaths.sh
108 "$MVN" "${MVN_GOALS[@]}" -Pq \
109 -s "$SETTINGS_FILE" \
110 -gs "$GLOBAL_SETTINGS_FILE" \
111 -DaltDeploymentRepository="opendaylight-snapshot::default::https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot" \
114 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
116 -Dmaven.repo.local=/tmp/r \
117 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
119 # Clear any changes caused by Maven build
121 git submodule foreach git checkout -f
127 if [ "$DRY_RUN" = "false" ]
129 # Push up patches last, as long as nothing failed.
130 git submodule foreach git review --yes -t "${TOPIC}"
133 echo "Version bumping complete."