Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions site/generate-jenkins-io-template.sh
Original file line number Diff line number Diff line change
@@ -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|<jio-navbar.*/jio-navbar>|<jio-navbar class='fixed-top' id='ji-toolbar' property='${PROPERTY}'></jio-navbar>|g" | \
sed -e "s|<jio-footer.*/jio-footer>|<jio-footer property='${PROPERTY}'></jio-footer>|g" \
> "$WWW_ROOT_DIR/index.html"
rm "$WWW_ROOT_DIR/index.tmp.html"
2 changes: 1 addition & 1 deletion site/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"