Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "JakartaEE New Infra Release Job"

(Input Parameters Processing)
Line 45: Line 45:
 
</pre>
 
</pre>
 
=== Input Parameters Processing ===
 
=== Input Parameters Processing ===
 +
RELEASE_VERSION and NEXT_VERSION values can be empty. Following code replaces empty values with proper values:
 +
* '''RELEASE_VERSION''': version number from current snapshot version string
 +
* '''NEXT_VERSION''': RELEASE_VERSION with latest version component incremented by 1 and <code>-SNAPSHOT</code> suffix
 +
Release tag name is also prepared.
 
<pre>
 
<pre>
 
# Maven plugins
 
# Maven plugins

Revision as of 08:36, 9 October 2018

Job parameters

This project is parameterized: checked

Name Type Default Description
RELEASE_VERSION String Version to release. Default value is from POM snapshot.
NEXT_VERSION String Next snapshot version to set (e.g. 1.2.3-SNAPSHOT). Default value is RELEASE_VERSION with last component incremented by 1.
BRANCH String master Branch to release. Default value is master.
DRY_RUN Boolean false Do not publish artifacts to OSSRH and code changes to GitHub.
OVERWRITE Boolean false Overwrite existing version in git and OSSRH staging repositories.

Shell script

Job Environment

Specific settings for Java build tools:

TOOLS_PREFIX='/opt/tools'
JAVA_PREFIX="${TOOLS_PREFIX}/java/oracle"
MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest"
JAVA_HOME="${JAVA_PREFIX}/jdk-9/latest"
PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Input Parameters Processing

RELEASE_VERSION and NEXT_VERSION values can be empty. Following code replaces empty values with proper values:

  • RELEASE_VERSION: version number from current snapshot version string
  • NEXT_VERSION: RELEASE_VERSION with latest version component incremented by 1 and -SNAPSHOT suffix

Release tag name is also prepared.

# Maven plugins
VERSIONS_PLUGIN='org.codehaus.mojo:versions-maven-plugin:2.5'
HELP_PLUGIN='org.apache.maven.plugins:maven-help-plugin:2.1.1'

# Top level pom.xml is  in root directory
# Check whether top level pom.xml contains SNAPSHOT version
if ! grep '<version>' pom.xml | grep 'SNAPSHOT' ; then
  echo '-[ Missing SNAPSHOT version in POM! ]-------------------------------------------'
  exit 1
fi

# Compute release versions
SNAPSHOT_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+-SNAPSHOT$'`

if [ -z "${RELEASE_VERSION}" ]; then
  if [ -z ${SNAPSHOT_VERSION} ]; then
    echo '-[ Missing required snapshot version number! ]----------------------------------'
  fi
  RELEASE_VERSION=`echo ${SNAPSHOT_VERSION} | sed -e 's/-SNAPSHOT//'`
fi

# Bash specific code
if [ -z "${NEXT_VERSION}" ]; then
  NEXT_VERSION=`echo ${RELEASE_VERSION} | sed -e 's/\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
  set -f
  NEXT_COMPONENTS=(${RELEASE_VERSION//\./ })
  LAST_INDEX=$((${#NEXT_COMPONENTS[@]} - 1))
  NEXT_COMPONENTS[${LAST_INDEX}]=$((${NEXT_COMPONENTS[${LAST_INDEX}]} + 1))
  NEXT_VERSION=`echo ${NEXT_COMPONENTS[@]} | tr ' ' '.'`'-SNAPSHOT'
fi

RELEASE_TAG="${RELEASE_VERSION}-RELEASE"

echo "Current version: ${SNAPSHOT_VERSION}"
echo "Release version: ${RELEASE_VERSION}"
echo "Next version:    ${NEXT_VERSION}"
echo "Release tag:     ${RELEASE_TAG}"

if [ -z "${SNAPSHOT_VERSION}" -o -z "${RELEASE_VERSION}" -o -z "${NEXT_VERSION}" ]; then
  echo '-[ Missing required version numbers! ]------------------------------------------'
  exit 1
fi

Back to the top