1) Error_Retry
1.1) retry into stage
node{
stage('build'){
retry(3){
error "Error statement just got executed"
}
}
}

1.2 ) build stage inside a retry block
node{
retry(3){
stage('build'){
error "Error statement just got executed"
}
}
}
Ở các hình bên dưới nó sẽ try cả stage luôn nhé


1.3) node inside a retry block
retry(3){
node{
error "Error statement just got executed"
}
}
node được retry 3 lần vì error

2) Timeout
2.1) timeout inside stage
node{
stage('build'){
timeout(time: 1, unit: 'SECONDS'){
// sleeping for 2 seconds
sleep 2
}
}
}

nhưng sleep làm stage trong 2s
vậy thì Aborted pipeline
2.2 ) build stage inside a retry timeout
node{
timeout(time: 1, unit: 'SECONDS'){
stage('build'){
// sleeping for 2 seconds
sleep 2
}
}
}

2.3 ) node inside a retry timeout
timeout(time: 1, unit: 'SECONDS'){
node{
stage('build'){
// sleeping for 2 seconds
sleep 2
}
}
}

3) Timestamps
https://newbedev.com/jenkins-pipeline-enable-timestamps-in-build-log-console
Như ở link trên thì bạn cần cài thêm plugin mới chạy được.

3.1) Timestamps for all stage
node{
timestamps{
stage('build'){
echo 'Build stage echo statement printed out with timestamp'
}
stage('deploy'){
echo 'Deploy stage echo statement printed out with timestamp'
}
}
}

3.1) Timestamps for particular stage
node{
stage('build'){
timestamps{
echo 'Build stage echo statement printed out with timestamp'
}
}
stage('deploy'){
echo 'Deploy stage echo statement printed out with timestamp'
}
}
