Skip to content

Commit

Permalink
ci_build.sh, Jenkinsfile-infra: introduce CI_TRY_HTMLPROOFER option [n…
Browse files Browse the repository at this point in the history
…etworkupstools#52]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed May 7, 2024
1 parent 0234840 commit 5d30110
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Jenkinsfile-infra
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ pipeline {
booleanParam(
name: 'CI_AVOID_SPELLCHECK',
defaultValue: true,
description: 'If "true", the spellcheck of site files would be a separate action with a non-fatal diagnosis after a site build an push (best-effort FYI); if "false" then spelling issues vs. master nut/docs/nut.dict would be fatal before site build.'
description: 'If "true", the spellcheck of site files would be a separate action with a non-fatal diagnosis after a site build and push (best-effort FYI); if "false" then spelling issues vs. master nut/docs/nut.dict would be fatal before site build.'
)
choice(
name: 'CI_TRY_HTMLPROOFER',
// FIXME: Initially "false" to boot-strap development on
// https://github.com/networkupstools/nut-website/issues/52
// and then should become "true" or "require" depending on
// achievements.
choices: ['false', 'true', 'require'],
description: 'If "true", the sanity-check of generated site files (cross-page links etc.) would be an action with a non-fatal diagnosis after a site build before a push (best-effort FYI); if "require" its faults would be fatal; if "false" then we would not waste several minutes on it.'
)
booleanParam(
name: 'NUT_DDL_PEDANTIC_DECLARATIONS',
Expand Down Expand Up @@ -106,7 +115,7 @@ pipeline {

def shRes
def msg
echo "Starting website build: CI_AUTOCOMMIT=${env.CI_AUTOCOMMIT} CI_AUTOPUSH=${env.CI_AUTOPUSH} CI_AVOID_RESPIN=${env.CI_AVOID_RESPIN} CI_AVOID_SPELLCHECK=${env.CI_AVOID_SPELLCHECK} BRANCH_NAME=${env.BRANCH_NAME}"
echo "Starting website build: CI_AUTOCOMMIT=${env.CI_AUTOCOMMIT} CI_AUTOPUSH=${env.CI_AUTOPUSH} CI_AVOID_RESPIN=${env.CI_AVOID_RESPIN} CI_AVOID_SPELLCHECK=${env.CI_AVOID_SPELLCHECK} CI_TRY_HTMLPROOFER=${env.CI_TRY_HTMLPROOFER} BRANCH_NAME=${env.BRANCH_NAME}"
withCredentials([gitUsernamePassword(credentialsId: scm.getUserRemoteConfigs()[0].getCredentialsId())]) {
// for git push in shell, using https://www.jenkins.io/blog/2021/07/27/git-credentials-binding-phase-1/
shRes = sh (returnStatus: true, script: "./ci_build.sh")
Expand Down
15 changes: 15 additions & 0 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
[ x"${NUT_HISTORIC_RELEASE-}" != x ] || NUT_HISTORIC_RELEASE=""
export CI_AUTOCOMMIT CI_AUTOPUSH CI_AVOID_RESPIN NUT_HISTORIC_RELEASE

# FIXME: Initially "false" to boot-strap development on
# https://github.com/networkupstools/nut-website/issues/52
# and then should become "true" or "require" depending on
# achievements.
case x"${CI_TRY_HTMLPROOFER-}" in
xtrue|xfalse|xrequire) ;;
*) CI_TRY_HTMLPROOFER=false ;;
esac
export CI_TRY_HTMLPROOFER

LANG=C
LC_ALL=C
TZ=UTC
Expand Down Expand Up @@ -72,6 +82,11 @@ case "${NUT_HISTORIC_RELEASE-}" in
;;
esac

if [ x"$CI_TRY_HTMLPROOFER" != xfalse ] ; then
echo "=== Sanity-checking the generated output directory..." >&2
make check-htmlproofer || if [ x"$CI_TRY_HTMLPROOFER" = xrequire ] ; then exit 1 ; fi
fi

# If we are here, there should be a populated "output" directory
# and there were no build issues
if $CI_AUTOCOMMIT && $CI_AUTOPUSH ; then
Expand Down

0 comments on commit 5d30110

Please sign in to comment.