我开始使用Jenkins declarative Pipeline。从一些我所看到的例子,我注意到Jenkinsfile是建立与管道指令:Jenkins管道Jenkinsfile:'node'和'pipeline'指令
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'make'
}
}
stage('Test'){
steps {
sh 'make check'
junit 'reports/**/*.xml'
}
}
stage('Deploy') {
steps {
sh 'make publish'
}
}
}
}
在其他例子中,我注意到Jenkinsfile是建立与节点的指令:
node {
stage 'Checkout'
checkout scm
stage 'Build'
bat 'nuget restore SolutionName.sln'
bat "\"${tool 'MSBuild'}\" SolutionName.sln /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
stage 'Archive'
archive 'ProjectName/bin/Release/**'
}
我一直无法找到关于何时/为什么要使用其中每一个的可靠文档。有没有人有任何信息,说明为什么这些不同以及何时适合使用它们中的任何一种?
我不确定,但我相信'节点'指令用于脚本管道,而不是声明式管道。
在此先感谢您的任何指导。
大非常感谢你获取信息! – J0991