Skip to content

Commit

Permalink
Jenkins release pipeline fix (eclipse-ee4j#1216)
Browse files Browse the repository at this point in the history
Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
  • Loading branch information
rfelcman committed Jul 16, 2021
1 parent dbfe9fb commit b171f20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
24 changes: 11 additions & 13 deletions etc/jenkins/includes/maven.incl.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
#
# Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

# Maven plugins
VERSIONS_PLUGIN='org.codehaus.mojo:versions-maven-plugin:2.7'
Expand Down Expand Up @@ -47,7 +45,7 @@ next_version() {
# "${1}_RELEASE_VERSION" - Release version
read_version() {
local VERSION_VAR="${1}_VERSION"
local SNAPSHOT_VERSION=`(cd ${2} && mvn -V -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+-SNAPSHOT$')`
local SNAPSHOT_VERSION=`(cd ${2} && mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+-SNAPSHOT$')`
if [ -z "${!VERSION_VAR}" ]; then
local RELEASE_VERSION="${SNAPSHOT_VERSION/-SNAPSHOT/}"
else
Expand All @@ -67,8 +65,8 @@ read_version() {
# "${1}_GROUP_ID" - Maven groupId
# "${1}_ARTIFACT_ID" - Maven artifactId
read_mvn_id() {
local GROUP_ID=`(cd ${2} && mvn -B -V ${HELP_PLUGIN}:evaluate -Dexpression=project.groupId | grep -Ev '(^\[)')`
local ARTIFACT_ID=`(cd ${2} && mvn -B -V ${HELP_PLUGIN}:evaluate -Dexpression=project.artifactId | grep -Ev '(^\[)')`
local GROUP_ID=`(cd ${2} && mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.groupId | grep -Ev '(^\[)')`
local ARTIFACT_ID=`(cd ${2} && mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.artifactId | grep -Ev '(^\[)')`
echo "${1} Group ID: ${GROUP_ID}"
echo "${1} Artifact ID: ${ARTIFACT_ID}"
eval "${1}_GROUP_ID"="${GROUP_ID}"
Expand All @@ -87,7 +85,7 @@ set_version() {
echo '--[ Set version ]---------------------------------------------------------------'
# Set release version
(cd ${2} && \
mvn -V -B -U -C \
mvn -U -C \
${6} \
-DnewVersion="${3}" \
-DgenerateBackupPoms=false \
Expand Down
18 changes: 8 additions & 10 deletions etc/jenkins/includes/nexus.incl.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
#
# Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

# Drop old artifacts from staging repository
# Arguments:
# $1 - Staging key value with grep REGEX prefixes
# $2 - Build directory
drop_artifacts() {
echo '-[ Drop old staging repository deployments ]------------------------------------'
for staging_key in `(cd ${2} && mvn -B -V nexus-staging:rc-list | egrep "^\[INFO\] [A-Z,a-z,-]+-[0-9]+\s+[A-Z]+\s+${1}" | awk '{print $2}')`; do
for staging_key in `(cd ${2} && mvn -B nexus-staging:rc-list | egrep "^\[INFO\] [A-Z,a-z,-]+-[0-9]+\s+[A-Z]+\s+${1}" | awk '{print $2}')`; do
echo "Repository ID: ${staging_key}"
(cd ${2} && \
mvn -U -C \
Expand Down
4 changes: 2 additions & 2 deletions etc/jenkins/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ HELP_PLUGIN='org.apache.maven.plugins:maven-help-plugin:3.1.0'
# $5 - OVERWRITE_STAGING - Allows to overwrite existing version in OSSRH (Jakarta) staging repositories

echo '-[ EclipseLink Release ]-----------------------------------------------------------'
. /etc/profile

ECLIPSELINK_VERSION="${1}"
NEXT_ECLIPSELINK_VERSION="${2}"
DRY_RUN="${3}"
OVERWRITE_GIT="${4}"
OVERWRITE_STAGING="${5}"


export MAVEN_SKIP_RC="true"
export ECLIPSELINK_DIR="."

Expand Down Expand Up @@ -97,7 +97,7 @@ fi

echo '-[ Build project mvn clean install ]-----------------------------'
#This step is needed to populate local Maven repository with required but not deployed artifacts
mvn -B -V --no-transfer-progress -DskipTests clean install
mvn --no-transfer-progress -DskipTests clean install
#Deploy selected artifacts. There is Maven property -Ddeploy to control which modules will be deployed
echo '-[ Deploy artifacts to staging repository ]-----------------------------'
# Verify, sign and deploy release
Expand Down

0 comments on commit b171f20

Please sign in to comment.