I have a Jenkinsfile and I want to be able to deploy maven build to different artifactory based on the build.
(我有一个Jenkinsfile,我希望能够根据构建将Maven构建部署到其他工件。)
For instance if the Jenkinsfile is triggered when I push my code to development branch I want to deploy the build from development branch to "maven-dev" artifactory. (例如,如果在我将代码推送到开发分支时触发了Jenkinsfile,我想将构建从开发分支部署到“ maven-dev”工件。)
I have 4 Git branches (dev, preprod, stage, prod) and subsequently 4 different Artifactory locations (maven-dev, maven-preprod, maven-stage, maven-prod). (我有4个Git分支(dev,preprod,stage,prod),然后有4个不同的Artifactory位置(maven-dev,maven-preprod,maven-stage,maven-prod)。)
I have the following script in my Jenkinsfile for build deployment however, I need to know what changes I need to make to the following script in order to be able to deploy each build (mentioned above) to the corresponding Artifactory location?
(我的Jenkinsfile中有以下脚本用于构建部署,但是,我需要知道我需要对以下脚本进行哪些更改才能将每个构建(上述)部署到相应的Artifactory位置?)
script {
def server = Artifactory.server('artifacts')
def rtMaven = Artifactory.newMavenBuild()
rtMaven.deployer server: server, releaseRepo: 'maven-prod', snapshotRepo: 'maven-dev'
def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean install -DskipTests=true -q -Dartifactory.publish.buildInfo=true'
buildInfo = Artifactory.newBuildInfo()
server.publishBuildInfo buildInfo
}
ask by Hosein Zarifi translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…