pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
echo "whoami".execute().text
script {
File f = new File('/home/jenkins/test2.txt');
f.createNewFile();
}
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
Jenkins控制台日志:(例外:由用户Edgar Yu开始运行耐久性级别:MAX_SURVIVABILITY [Pipeline]节点在/ var/jenkins_home/workspace/test2 [Pipeline] {[Pipeline] stage [Pipeline] {(Build)上的Jenkins上运行[Pipeline] echo Building .. [Pipeline] echo jenkins
[管道]脚本[管道] {[管道]} [管道] //脚本[管道]} [管道] //阶段[管道]阶段[管道] {(测试)阶段'测试'由于早期故障而被跳过(s )[Pipeline]} [Pipeline] // stage [Pipeline] stage [Pipeline] {(Deploy)Stage'Deeploy'由于早期失败而被跳过[Pipeline]} [Pipeline] // stage [Pipeline]} [Pipeline] ] // …