Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JakartaEE New Infra Release Job"
(→Input Parameters Processing) |
|||
Line 35: | Line 35: | ||
== Shell script == | == Shell script == | ||
+ | |||
=== Job Environment === | === Job Environment === | ||
+ | |||
Specific settings for Java build tools: | Specific settings for Java build tools: | ||
<pre> | <pre> | ||
Line 44: | Line 46: | ||
PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
</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 and NEXT_VERSION values can be empty. Following code replaces empty values with proper values: | ||
* '''RELEASE_VERSION''': version number from current snapshot version string | * '''RELEASE_VERSION''': version number from current snapshot version string | ||
Line 93: | Line 97: | ||
fi | fi | ||
</pre> | </pre> | ||
+ | |||
+ | === Git and Build Environment Preparation === | ||
+ | |||
+ | If '''OVERWRITE''' argument is active (true), remote release branch and tag names are deleted. | ||
+ | If '''DRY_RUN''' argument is active (true), <code>deploy:deploy</code> argument won't be passed to maven. | ||
+ | Old local release branch and tag are always deleted if exist and local release branch is initialized to store all code changes related to this release. | ||
+ | GitHub bot name and e-mail are set in git configuration. | ||
+ | <pre> | ||
+ | if [ ${DRY_RUN} = 'true' ]; then | ||
+ | echo '-[ Dry run turned on ]----------------------------------------------------------' | ||
+ | MVN_DEPLOY_ARGS='' | ||
+ | echo '-[ Skipping GitHub branch and tag checks ]--------------------------------------' | ||
+ | else | ||
+ | MVN_DEPLOY_ARGS='deploy:deploy' | ||
+ | GIT_ORIGIN=`git remote` | ||
+ | echo '-[ Prepare branch ]-------------------------------------------------------------' | ||
+ | if [[ -n `git branch -r | grep "${GIT_ORIGIN}/${RELEASE_VERSION}"` ]]; then | ||
+ | if [ "${OVERWRITE}" = 'true' ]; then | ||
+ | echo "${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists, deleting" | ||
+ | git push --delete origin "${RELEASE_VERSION}" && true | ||
+ | else | ||
+ | echo "Error: ${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists" | ||
+ | exit 1 | ||
+ | fi | ||
+ | fi | ||
+ | echo '-[ Release tag cleanup ]--------------------------------------------------------' | ||
+ | if [[ -n `git ls-remote --tags ${GIT_ORIGIN} | grep "${RELEASE_TAG}"` ]]; then | ||
+ | if [ "${OVERWRITE}" = 'true' ]; then | ||
+ | echo "${RELEASE_TAG} tag already exists, deleting" | ||
+ | git push --delete origin "${RELEASE_TAG}" && true | ||
+ | else | ||
+ | echo "Error: ${RELEASE_TAG} tag already exists" | ||
+ | exit 1 | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | # Always delete local branch if exists | ||
+ | git branch --delete "${RELEASE_VERSION}" && true | ||
+ | git checkout -b ${RELEASE_VERSION} | ||
+ | # Always delete local tag if exists | ||
+ | git tag --delete "${RELEASE_TAG}" && true | ||
+ | |||
+ | # Setup jaxb-impl-bot account information | ||
+ | git config --global user.email "jaxb-impl-bot@eclipse.org" | ||
+ | git config --global user.name "Eclipse JAXBimpl Bot" | ||
+ | </pre> | ||
+ | |||
+ | === Workaround: GPG initialization === | ||
+ | |||
+ | GPG setup is missing in Docker image and GPG keys are passed in KEYRING environment variables. Content of this variable must be processed and stored into GPG key store. | ||
+ | <pre> | ||
+ | # Workaround: GPG initialization | ||
+ | gpg --batch --import ${KEYRING} | ||
+ | for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u); | ||
+ | do | ||
+ | echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust; | ||
+ | done | ||
+ | </pre> | ||
+ | |||
+ | === Release version === |
Revision as of 08:48, 9 October 2018
Contents
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
Git and Build Environment Preparation
If OVERWRITE argument is active (true), remote release branch and tag names are deleted.
If DRY_RUN argument is active (true), deploy:deploy
argument won't be passed to maven.
Old local release branch and tag are always deleted if exist and local release branch is initialized to store all code changes related to this release.
GitHub bot name and e-mail are set in git configuration.
if [ ${DRY_RUN} = 'true' ]; then echo '-[ Dry run turned on ]----------------------------------------------------------' MVN_DEPLOY_ARGS='' echo '-[ Skipping GitHub branch and tag checks ]--------------------------------------' else MVN_DEPLOY_ARGS='deploy:deploy' GIT_ORIGIN=`git remote` echo '-[ Prepare branch ]-------------------------------------------------------------' if [[ -n `git branch -r | grep "${GIT_ORIGIN}/${RELEASE_VERSION}"` ]]; then if [ "${OVERWRITE}" = 'true' ]; then echo "${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists, deleting" git push --delete origin "${RELEASE_VERSION}" && true else echo "Error: ${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists" exit 1 fi fi echo '-[ Release tag cleanup ]--------------------------------------------------------' if [[ -n `git ls-remote --tags ${GIT_ORIGIN} | grep "${RELEASE_TAG}"` ]]; then if [ "${OVERWRITE}" = 'true' ]; then echo "${RELEASE_TAG} tag already exists, deleting" git push --delete origin "${RELEASE_TAG}" && true else echo "Error: ${RELEASE_TAG} tag already exists" exit 1 fi fi fi # Always delete local branch if exists git branch --delete "${RELEASE_VERSION}" && true git checkout -b ${RELEASE_VERSION} # Always delete local tag if exists git tag --delete "${RELEASE_TAG}" && true # Setup jaxb-impl-bot account information git config --global user.email "jaxb-impl-bot@eclipse.org" git config --global user.name "Eclipse JAXBimpl Bot"
Workaround: GPG initialization
GPG setup is missing in Docker image and GPG keys are passed in KEYRING environment variables. Content of this variable must be processed and stored into GPG key store.
# Workaround: GPG initialization gpg --batch --import ${KEYRING} for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust; done