From e14ee6c2e5698b07ec01bfd75ae65815e2bd98a0 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Thu, 5 Jan 2023 01:48:39 -0800 Subject: [PATCH 1/6] fix: Support web components for nav and footer on jenkins.io https://github.com/jenkins-infra/jenkins.io/pull/5668#issuecomment-1371927933 --- site/generate-jenkins-io-template.sh | 8 ++++++++ site/generate.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 site/generate-jenkins-io-template.sh diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh new file mode 100755 index 000000000..b75e692ab --- /dev/null +++ b/site/generate-jenkins-io-template.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" +SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" + +wget -q --convert-links -O "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html +sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" +sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" diff --git a/site/generate.sh b/site/generate.sh index 94048f10d..8bf699671 100755 --- a/site/generate.sh +++ b/site/generate.sh @@ -165,5 +165,5 @@ popd # copy other static resource files echo '{}' > "$WWW_ROOT_DIR/uctest.json" -wget -q --convert-links -O "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html +"${MAIN_DIR}/site/generate-jenkins-io-template.sh" "$WWW_ROOT_DIR" "https://updates.jenkins.io" cp -av "tmp/tiers.json" "$WWW_ROOT_DIR/tiers.json" From 2e4ea9825b56181265ab23de7fd567f40936861d Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Thu, 5 Jan 2023 02:59:50 -0800 Subject: [PATCH 2/6] Update site/generate-jenkins-io-template.sh Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> --- site/generate-jenkins-io-template.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh index b75e692ab..f17c4a3aa 100755 --- a/site/generate-jenkins-io-template.sh +++ b/site/generate-jenkins-io-template.sh @@ -3,6 +3,6 @@ WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" -wget -q --convert-links -O "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html +wget --quiet --convert-links --output-document "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" From 9a31e3d7efd807ef0607882aa8d93aac890857b1 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Thu, 5 Jan 2023 03:00:09 -0800 Subject: [PATCH 3/6] Update site/generate-jenkins-io-template.sh Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> --- site/generate-jenkins-io-template.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh index f17c4a3aa..861c59b1a 100755 --- a/site/generate-jenkins-io-template.sh +++ b/site/generate-jenkins-io-template.sh @@ -4,5 +4,5 @@ WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" wget --quiet --convert-links --output-document "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html -sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" -sed -i -e "s|||g" "$WWW_ROOT_DIR/index.html" +sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" +sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" From cf1e8faa14ffe80a5c6b145773cb5b2321011930 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Thu, 5 Jan 2023 03:00:17 -0800 Subject: [PATCH 4/6] Update site/generate-jenkins-io-template.sh Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> --- site/generate-jenkins-io-template.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh index 861c59b1a..5f29eafc6 100755 --- a/site/generate-jenkins-io-template.sh +++ b/site/generate-jenkins-io-template.sh @@ -3,6 +3,10 @@ WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" +set -o errexit +set -o nounset +set -o pipefail + wget --quiet --convert-links --output-document "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" From f617411056c0b1e8928b470c43adf62b464d38df Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Thu, 5 Jan 2023 03:01:52 -0800 Subject: [PATCH 5/6] Update generate-jenkins-io-template.sh --- site/generate-jenkins-io-template.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh index 5f29eafc6..3149527fa 100755 --- a/site/generate-jenkins-io-template.sh +++ b/site/generate-jenkins-io-template.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# Downloads the template from jenkins.io, then updates the navshell web components to update center specific values + WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" From 48e3443db8e1bbc9f2bb59262b84e7fb575f7efb Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Fri, 6 Jan 2023 14:51:51 -0800 Subject: [PATCH 6/6] Cleanup generate jenkins io template * Switch to cat | sed to make it more osx portable * Document with usage when bad parameters --- site/generate-jenkins-io-template.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh index 3149527fa..8d872cd31 100755 --- a/site/generate-jenkins-io-template.sh +++ b/site/generate-jenkins-io-template.sh @@ -2,13 +2,29 @@ # Downloads the template from jenkins.io, then updates the navshell web components to update center specific values +USAGE="Usage: $0 [WWW_ROOT_DIR] [PROPERTY] + +1 - WWW_ROOT_DIR - where index.html should be stored - default ./www2 +2 - PROPERTY - which jenkins property - default https://updates.jenkins.io + +Can be either environmental variables or ordered arguments +" + +[[ $# -gt 2 ]] && { echo "${USAGE}" >&2 ; exit 1 ; } + WWW_ROOT_DIR="${WWW_ROOT_DIR:-${1:-./www2}}" -SELF_URL="${SELF_URL:-${2:-https://updates.jenkins.io}}" +PROPERTY="${PROPERTY:-${2:-https://updates.jenkins.io}}" + +[[ -z "$WWW_ROOT_DIR" ]] && { echo "${USAGE}No WWW_ROOT provided" >&2 ; exit 1 ; } +[[ -z "$PROPERTY" ]] && { echo "${USAGE}No PROPERTY provided" >&2 ; exit 1 ; } set -o errexit set -o nounset set -o pipefail -wget --quiet --convert-links --output-document "$WWW_ROOT_DIR/index.html" --convert-links https://www.jenkins.io/templates/updates/index.html -sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" -sed -i.bak -e "s|||g" "$WWW_ROOT_DIR/index.html" +wget --quiet --convert-links --output-document "$WWW_ROOT_DIR/index.tmp.html" https://www.jenkins.io/templates/updates/index.html +cat "$WWW_ROOT_DIR/index.tmp.html" | \ + sed -e "s|||g" | \ + sed -e "s|||g" \ + > "$WWW_ROOT_DIR/index.html" +rm "$WWW_ROOT_DIR/index.tmp.html"