简体   繁体   English

从Multibranch管道Jenkinsfile触发部署作业

[英]Trigger deployment job from Multibranch pipeline Jenkinsfile

So, we are currently using Multibranch pipeline to run our Continuous Integration process and the last stage is publish the deployable artifact in our JFrog Artifactory "dev" repository and this works! 因此,我们当前正在使用Multibranch管道来运行我们的持续集成过程,最后一步是在JFrog Artifactory“ dev”存储库中发布可部署的工件,并且可以正常工作!

My problem is that, if I want to automatically trigger a new Jenkins job to take that deployable artifact and deploy it into an integration server and run functional tests then I imagine I would do something like this at the end of my Jenkinfile: 我的问题是,如果我想自动触发一个新的Jenkins作业以采用该可部署的工件并将其部署到集成服务器中并运行功能测试,那么我想我会在Jenkinfile的末尾执行以下操作:

stage("trigger artifact deployment") {
    build job: deploymentPipeline,
            parameters: [[$class: 'StringParameterValue', name: 'deployableArtifactId', value: "${name}-${version}"],
                         [$class: 'StringParameterValue', name: 'projectName', value: name],
                         [$class: 'StringParameterValue', name: 'projectVersion', value: version]],
                        ...
            wait: false
}

This approach works! 这种方法行得通! However and because it's a Multibranch pipeline, I would have to hardcode the Jenkins job I want to trigger which I really rather not do but I don't know what else to try as I don't think there would be another way to get the info I need to find the artifact to deploy (ID, version, name, etc.), right? 但是,由于这是一个多分支管道,因此我不得不对我想触发的詹金斯工作进行硬编码,而我本来不愿意这样做,但是我不知道还能尝试什么,因为我不认为会有其他方法来获得信息我需要找到要部署的工件(ID,版本,名称等),对吗?

If you just published it to artifactory, why do you need to find it again? 如果您只是将其发布到人工制品上,为什么还要再次找到它? I would add Artifactory properties to the file on upload to enable easier retrieval again. 我会在上传文件时将Artifactory属性添加到文件中,以便再次轻松进行检索。

https://www.jfrog.com/confluence/display/RTF/Properties https://www.jfrog.com/confluence/display/RTF/Properties

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM