Reputation: 37
Is there any option how to add "perform maven release" button into jenkins pipeline job. I am using option with another stage in pipeline which wait 2 minutes for user input but I don't like that every time job job waits and release is only sometimes.
Thanks.
https://i.sstatic.net/vwFF6.jpg
Upvotes: 3
Views: 2383
Reputation: 265
I've he same issue... No, The M2 Release plugin only works with Maven projects, not freestyle or Pipeline, but you can use user input from pipeline to achieve the same result:
stage('release')
{
def performRelease = input message : "Perform Maven Release?",
ok : "Schedule Maven Release Build",
submitter : env.ALLOWED_SUBMITTER_RELEASE,
submitterParameter : 'APPROVING_SUBMITTER',
parameters:
[
booleanParam
(
defaultValue: true,
description: '',
name: 'Dry run only?'
),
string
(
defaultValue: '',
description: '',
name: 'Release Version'
),
string
(
defaultValue: '',
description: '',
name: 'Development version'
)
]
if( performRelease )
{
dir( env.PROJECT_FOLDER )
{
withMaven(jdk: env.JDK_VERSION , maven: env.MVN_VERSION )
{
sh "mvn ${ performRelease['Dry run only?'] ? env.MVN_RELEASE_DRYRUN_GOALS : env.MVN_RELEASE_GOALS }"
}
}
}
}
Upvotes: 5