Jenkins 7 - 서술적 파이프라인 문법
기본 구조
1. 노드 블록
node('<parameter>') {<constituents>}2. 스테이지 블록
stage('<parameter>') {<constituents>}3. 디렉티브
4. 스텝
node('master') {
// Directive 1
def mvnHome
// Stage block 1
stage('Preparation') {
// Step 1
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
// Directive 2
mvnHome = tool 'M3'
}
// Staage block 2
stage('Build') {
// Step 2
withEnv(["MVN_HOME=$mvnHome"]) {
if (isUnix()) {
sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package'
} else {
bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
}
// Stage block 3
stage('Results') {
// Step 3
junit '**/target/surefire-reports/TEST-*.xml'
// Step 4
archiveArtifacts 'target/*.jar'
}
}Last updated