Skip to content

Commit

Permalink
fix: Variable for specifing Nexus staging repository prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Feb 20, 2018
1 parent 68e7e43 commit c7636a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion jenkins/maven-Jenkinsfile
Expand Up @@ -42,6 +42,10 @@ timestamps {
// e.g. parent/pom.xml in zanata-platform
String versionPomXml = "${WORK_DIR}/pom.xml"

// Prefix of Nexus Staging repository
// e.g. orgzanata
String nexusStagingRepositoryPrefix = 'orgzanata'

boolean hasReleaseNotes = false


Expand Down Expand Up @@ -115,7 +119,10 @@ timestamps {
nexusStagingProjects = env.PLATFORM_MAVEN_NEXUS_RELEASE_PROJECTS
versionPomXml = "${WORK_DIR}/parent/pom.xml"
hasReleaseNotes = true
} else if (REPO_NAME == 'openprops') {
nexusStagingRepositoryPrefix = 'orgfedorahostedopenprops'
}

dir(WORK_DIR) {

checkout changelog: false, poll: false, scm:
Expand Down Expand Up @@ -200,7 +207,7 @@ timestamps {
}
stage('NexusRelease') {
// Release nexus staging repo and push the git tag
sh "bash $WORKSPACE/zanata-nexus-release -p $nexusStagingProjects"
sh "bash $WORKSPACE/zanata-nexus-release -s $nexusStagingRepositoryPrefix -p $nexusStagingProjects"
}
stage('SetSnapshotVersion') {
sh(returnStatus: true,
Expand Down
8 changes: 7 additions & 1 deletion zanata-maven-release
Expand Up @@ -263,6 +263,7 @@ print_status -t release -s "Start"
MavenVersionProjects=
NexusReleaseProjects=
TagPrefix=
NexusStagingRepositoryPrefix=
case $RepoName in
zanata-platform )
## chooses projects whose versions should be changed
Expand All @@ -275,6 +276,11 @@ case $RepoName in

## the prefix for the git tag, eg platform-
TagPrefix="${ArtifactId}-"

NexusStagingRepositoryPrefix='orgzanata'
;;
openprops )
NexusStagingRepositoryPrefix='org.zanata'
;;
* )
;;
Expand All @@ -292,7 +298,7 @@ $ScriptDir/zanata-nexus-staging "$NexusReleaseProjects"
## Release staged artifacts from Nexus Staging
## after which they will be synced to Maven Central
print_status " Release staged artifacts from Nexus Staging"
$ScriptDir/zanata-nexus-release -p "$NexusReleaseProjects"
$ScriptDir/zanata-nexus-release -s "$NexusStagingRepositoryPrefix" -p "$NexusReleaseProjects"

## Set pom.xml version to next SNAPSHOT version $DevelopmentVersion
## e.g. 4.6.0-SNAPSHOT
Expand Down
8 changes: 6 additions & 2 deletions zanata-nexus-release
Expand Up @@ -37,9 +37,10 @@ source "$FunctionScriptFile"
trap exit_print_error EXIT

PushMode=0
NexusStagingRepositoryPrefix=orgzanata
###
### OPTIONS
while getopts "hp" opt;do
while getopts "hps:" opt;do
case $opt in
### -h: Show detail help
h )
Expand All @@ -49,6 +50,9 @@ while getopts "hp" opt;do
p )
PushMode=1
;;
s )
NexusStagingRepositoryPrefix=$OPTARG
;;
* )
failed ${EXIT_FATAL_INVALID_OPTIONS} "$opt"
;;
Expand Down Expand Up @@ -84,7 +88,7 @@ fi
get_StagingRepository(){
## We only query the "root" project, which only takes 10 secs
## Querying on all projects takes 1:09 minutes.
local StagingRepositoryBuffer=$(run_command ./mvnw $MAVEN_NEXUS_STAGING_OPTIONS ${MAVEN_NEXUS_STAGING_PLUGIN}:rc-list -pl . | sed -r -n -e '/orgzanata-.* / s/^\[INFO\] (orgzanata-[0-9]+)\s*([A-Z]+)/\1 \2/ p' )
local StagingRepositoryBuffer=$(run_command ./mvnw $MAVEN_NEXUS_STAGING_OPTIONS ${MAVEN_NEXUS_STAGING_PLUGIN}:rc-list -pl . | sed -r -n -e '/'$NexusStagingRepositoryPrefix'-.* / s/^\[INFO\] ('$NexusStagingRepositoryPrefix'-[0-9]+)\s*([A-Z]+)/\1 \2/ p' )
if [[ $DryRunMode -eq 0 ]]; then
if [[ -n $StagingRepositoryBuffer ]]; then
StagingRepositoryId=$( awk '{print $1}' <<<"$StagingRepositoryBuffer" | tail -n 1 )
Expand Down

0 comments on commit c7636a2

Please sign in to comment.