jenkins管道输入通过电子邮件

问题描述:

我正在使用詹金斯管道 我想用户通过电子邮件给予输入 我试过这个,但没有帮助。jenkins管道输入通过电子邮件

def tok = UUID.randomUUID().toString() 
mail to: '[email protected]', subject: 'Ready to roll?', mimeType: 'text/html', 
body: """Please <a href="${env.JENKINS_URL}pipeline-inputs/${tok}/proceed">approve me</a>!""" 
input message: 'Ready?', token: tok 

任何关于这个的指针,我想令牌或任何类型的身份验证也。 在此先感谢

+0

您是否尝试过提交请求'卷曲'或邮差?是否需要POST请求? – StephenKing

 emailext mimeType: 'text/html', 
       subject: "[Jenkins]${currentBuild.fullDisplayName}", 
       to: "[email protected]", 
       body: '''<a href="${BUILD_URL}input">click to approve</a>''' 

     def userInput = input id: 'userInput', 
           message: 'Let\'s promote?', 
           submitterParameter: 'submitter', 
           submitter: 'tom', 
           parameters: [ 
           [$class: 'TextParameterDefinition', defaultValue: 'sit', description: 'Environment', name: 'env'], 
           [$class: 'TextParameterDefinition', defaultValue: 'k8s', description: 'Target', name: 'target']] 

     echo ("Env: "+userInput['env']) 
     echo ("Target: "+userInput['target']) 
     echo ("submitted by: "+userInput['submitter']) 

汤姆会收到包含输入网址邮件,只有Tom可以成功提交的输入。