diff --git a/site/generate-jenkins-io-template.sh b/site/generate-jenkins-io-template.sh new file mode 100755 index 000000000..8d872cd31 --- /dev/null +++ b/site/generate-jenkins-io-template.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# 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}}" +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.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" 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"