我之前从未尝试过Jenkinsfile,但这是问题所在。 当我从网上运行示例时,似乎它就像挂起一样。来自控制台输出的消息如下:
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor
我尝试运行的代码如下:
#!/usr/bin/env groovy
/**
* Sample Jenkinsfile for Jenkins2 Pipeline
* from https://github.com/hotwilson/jenkins2/edit/master/Jenkinsfile
* by wilsonmar@gmail.com
*/
import hudson.model.*
import hudson.EnvVars
import groovy.json.JsonSlurperClassic
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
import java.net.URL
try {
node {
stage '\u2776 Stage 1'
echo "\u2600 BUILD_URL=${env.BUILD_URL}"
def workspace = pwd()
echo "\u2600 workspace=${workspace}"
stage '\u2777 Stage 2'
} // node
} catch (exc) {
/*
err = caughtError
currentBuild.result = "FAILURE"
String recipient = 'infra@lists.jenkins-ci.org'
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}) failed",
body: "It appears that ${env.BUILD_URL} is failing, somebody should do something about that",
to: recipient,
replyTo: recipient,
from: 'noreply@ci.jenkins.io'
*/
} finally {
(currentBuild.result != "ABORTED") && node("master") {
// Send e-mail notifications for failed or unstable builds.
// currentBuild.result must be non-null for this step to work.
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: "${email_to}",
sendToIndividuals: true
])
}
// Must re-throw exception to propagate error:
if (err) {
throw err
}
}
我做错了什么?
谢谢
答案 0 :(得分:0)
您的节点中没有剩余的错误状态(我假设是大师) 转到 --> 管理 Jenkins --> 管理节点和云 --> 输入您的节点 --> 配置 --> 增加执行程序数量