在Jenkins UI中,在Build Trigger--〉Trigger builds remotely (e.g., from scripts)下有一个设置Authentication Token的选项。任何配置更改都需要通过jenkins脚本完成。如何在jenkins脚本中设置身份验证令牌?
Build Trigger
Trigger builds remotely (e.g., from scripts)
Authentication Token
hsgswve41#
您可以使用JobDSL插件在Jenkinsfile中创建和管理作业:https://jenkinsci.github.io/job-dsl-plugin/#path/job-authenticationToken基本示例:
pipeline { agent any stages { stage('Demo') { steps { jobDsl scriptText: ''' job('demo') { authenticationToken("this-is-just-an-example-token") steps { shell('echo Hello World!') } } ''' } } } }
1条答案
按热度按时间hsgswve41#
您可以使用JobDSL插件在Jenkinsfile中创建和管理作业:
https://jenkinsci.github.io/job-dsl-plugin/#path/job-authenticationToken
基本示例: