groovy作业DSL,用于基于新版本标签触发jenkins [英] groovy job DSL for triggering jenkins based on new release tags
问题描述
当在github上的git repo上创建了一个新的发布标签时,我碰到了jenkins job的设置触发jenkins,但想知道相当于groovy job DSL脚本是什么.
I came across this setting for jenkins job to trigger jenkins when a new release tag is created on git repo like github but wondering what the equivalent is for groovy jobs DSL script.
Here is also link to same question asked but without the groovy job DSL script version jenkins trigger build if new tag is released
一个人怎么知道如何基于詹金斯的工作设置编写普通的工作DSL脚本?在将jenkins作业转换为作业DSL脚本时,我还没有找到一个很好的文档来解释登录信息
How can one know how to write groovy job DSL scripts based on jenkins job settings? I am yet to find a great documentation that explains the login when it comes to converting jenkins jobs to job DSL scriprs
谢谢
推荐答案
内置的Jenkins管道语法工具应该能够帮助您为希望与DSL一起使用的任何插件创建脚本块.任何管道作业都将在左侧具有一个链接.
The built in Jenkins pipeline syntax tool should be able to help you create the script block for any of the plugins that you wish to use with the DSL. Any pipeline job will have a link for it on the left hand side.
这是您输入所有信息(即:回购位置,分支,身份验证)后的大致样子.如果您在语法页面上,则需要的部分是refspec,它将位于高级按钮下.
This is roughly what it will look like after you enter in all your information (ie: repo location, branches, authentication). The part that you need is the refspec if you are on the syntax page it will be under the advanced button.
checkout([$class: 'GitSCM', branches: [[name: '**']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'yourAuthHere', refspec: '+refs/tags/*:refs/remotes/origin/tags/*', url: 'yourGitRepoLocationHere']]])
这篇关于groovy作业DSL,用于基于新版本标签触发jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!