Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Jenkinsfile.no-agent-timeout.violation1.declarative
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//NO TIMOUT ON PIPELINE, NO TIMOUT ON AGENT

pipeline {

agent none
stages {
stage('Load Test') { //VIOLATION - NO TIMEOUT ON STAGE
agent {
label 'load-test-agent'
}
steps {
// timeout is in steps because a timeout on a "stage" would span across the "input" as well
timeout(time: 60, unit: 'MINUTES') { //executor timeout - wraps steps
echo "Load test..."
// ... will take several hours
echo "Load test finished"
}
}
}
}
}
File renamed without changes.
21 changes: 21 additions & 0 deletions Jenkinsfile.violation.input-step-on-agent.declarative
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pipeline {
agent none
stages {
stage('Load Test') {
agent {
label 'load-test-agent'
}
input { //VIOLATION - NO TIMOUT ON THIS INPUT
message 'Deploy on load test environment?'
}
steps {
// timeout is in steps because a timeout on a "stage" would span across the "input" as well
timeout(time: 60, unit: 'MINUTES') { //executor timeout - wraps steps
echo "Load test..."
// ... will take several hours
echo "Load test finished"
}
}
}
}
}
34 changes: 34 additions & 0 deletions Jenkinsfile.violation.no-timeout.on.pipeline.declarative
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//NO TIMEOUT ON PIPELINE, TIMEOUT EXISTS ON EXECUTORS

pipeline {
agent none
stages {
stage('Build') {
agent {
label 'java'
}
options { //executor timeout - on stage
timeout(time: 60, unit: 'MINUTES')
}
steps {
sh "./mvnw clean verify"
}
}
stage('Load Test') {
agent {
label 'load-test-agent'
}
input {
message 'Deploy on load test environment?'
}
steps {
// timeout is in steps because a timeout on a "stage" would span across the "input" as well
timeout(time: 60, unit: 'MINUTES') { //executor timeout - wraps steps
echo "Load test..."
// ... will take several hours
echo "Load test finished"
}
}
}
}
}