cd: Cleaned up canonical name test
All checks were successful
nathanwoodburn/woodburn/pipeline/head This commit looks good
All checks were successful
nathanwoodburn/woodburn/pipeline/head This commit looks good
This commit is contained in:
parent
625359566d
commit
e94c2c66a8
7
Jenkinsfile
vendored
7
Jenkinsfile
vendored
@ -2,23 +2,18 @@ pipeline {
|
|||||||
agent any
|
agent any
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Check HTML Files') {
|
stage('Verify canonical tags') {
|
||||||
steps {
|
steps {
|
||||||
// Search for occurrences of the file name with the .html extension
|
|
||||||
script {
|
script {
|
||||||
def fileExists = false
|
def fileExists = false
|
||||||
|
|
||||||
// Find files with occurrences of the file name with the .html extension
|
|
||||||
def affectedFiles = sh(
|
def affectedFiles = sh(
|
||||||
script: 'find . -type f -name "*.html" -exec grep -l "{}" "{}" \\;',
|
script: 'find . -type f -name "*.html" -exec grep -l "{}" "{}" \\;',
|
||||||
returnStdout: true
|
returnStdout: true
|
||||||
).trim()
|
).trim()
|
||||||
|
|
||||||
// If affectedFiles is not empty, set fileExists to true
|
// If affectedFiles is not empty, set fileExists to true
|
||||||
if (affectedFiles) {
|
if (affectedFiles) {
|
||||||
fileExists = true
|
fileExists = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail the build and display the affected files
|
// Fail the build and display the affected files
|
||||||
if (fileExists) {
|
if (fileExists) {
|
||||||
error("Error: Found occurrences of file names with the .html extension in the following files:\n${affectedFiles}")
|
error("Error: Found occurrences of file names with the .html extension in the following files:\n${affectedFiles}")
|
||||||
|
Loading…
Reference in New Issue
Block a user