Skip to content

Commit

Permalink
add step to validate werks html before uploading
Browse files Browse the repository at this point in the history
CMK-14590

Change-Id: I3f6cd7e9faa5a94395e4756a6cbd4212bba5dd60
  • Loading branch information
BenediktSeidl committed Dec 13, 2023
1 parent a967b60 commit e798da4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions buildscripts/scripts/compile-all-werks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,37 @@ def main() {
}
}

stage("Validate HTML") {
docker.withRegistry(DOCKER_REGISTRY, 'nexus') {
docker_image_from_alias("IMAGE_TESTING").inside("${docker_args}") {
try {
dir("${checkout_dir}") {
sh("""
npm ci
echo '<!DOCTYPE html><html lang="en"><head><title>werks</title></head><body>' >${WORKSPACE}/index.html
# still no need for jq!
python3 -c 'import json; print("\n".join(("\n\n<p>{}</p>\n{}".format(key, value["description"]) for key, value in json.load(open("${WORKSPACE}/all_werks.json")).items())))' >>${WORKSPACE}/index.html
echo '</body></html>' >>${WORKSPACE}/index.html
java -jar node_modules/vnu-jar/build/dist/vnu.jar --filterpattern 'The .tt. element is obsolete\. Use CSS instead\.' --stdout --format gnu - <${WORKSPACE}/index.html >${WORKSPACE}/errors.txt
""")
}
} catch {
archiveArtifacts(
artifacts: [
${WORKSPACE}"/index.html"
${WORKSPACE}"/errors.txt"
],
fingerprint: true,
);
sh("""
cat "${WORKSPACE}/errors.txt"
echo "Found invalid html. See errors above, compare the line numbers with index.html artifact."
""")
}
}
}
}

targets_credentials.each{target_credential ->
def target = target_credential[0];
def credentials_id = target_credential[1];
Expand Down

0 comments on commit e798da4

Please sign in to comment.