cd: Error if html in file
Some checks failed
Woodburn Main/woodburn/pipeline/head There was a failure building this commit
Some checks failed
Woodburn Main/woodburn/pipeline/head There was a failure building this commit
This commit is contained in:
parent
bb70f69a34
commit
8331ede34c
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@ -2,9 +2,27 @@ pipeline {
|
|||||||
agent any
|
agent any
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('None') {
|
stage('Test Files') {
|
||||||
steps {
|
steps {
|
||||||
echo "Done"
|
// Search for occurrences of "<filename>.html"
|
||||||
|
script {
|
||||||
|
def fileExists = false
|
||||||
|
|
||||||
|
// Find files with "<filename>.html" occurrences
|
||||||
|
def affectedFiles = sh returnStdout: true, script: 'grep -rl ".html" ./*.html'
|
||||||
|
// Trim
|
||||||
|
affectedFiles = affectedFiles.trim()
|
||||||
|
|
||||||
|
// If affectedFiles is not empty, set fileExists to true
|
||||||
|
if (affectedFiles) {
|
||||||
|
fileExists = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fail the build and display the affected files
|
||||||
|
if (fileExists) {
|
||||||
|
error("Error: Found occurrences of 'filename.html' in the following files:\n${affectedFiles}")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user