/ /メールによるjenkinsパイプライン入力-jenkins、groovy、jenkins-pipeline

電子メールによるジェンキンスパイプライン入力 - jenkins、groovy、jenkins-pipeline

私はジェンキンスパイプラインを使用しています ユーザーにメールで入力してほしい 私はこれを試しましたが、助けにはなりませんでした。

def tok = UUID.randomUUID().toString()
mail to: "admins@mycorp", 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

これに関する任意のポインタ、私はトークンまたは任意のタイプの認証も必要です。 前もって感謝します

回答:

回答№1は2
        emailext mimeType: "text/html",
subject: "[Jenkins]${currentBuild.fullDisplayName}",
to: "tom@xxx.com",
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"])

トムは入力URLを含むメールを受信し、トムだけが入力を正常に送信できます。