From a2035090d25788dac70298a6fa76371ce8940701 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 25 Jul 2018 10:28:17 -0700 Subject: [PATCH 1/6] adding param for list of tags to display on website --- ci/docker/runtime_functions.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index a0795eb58a5a..8805850e3145 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -814,7 +814,11 @@ build_docs() { set -ex pushd . cd /work/mxnet/docs/build_version_doc - ./build_all_version.sh $1 + # Parameters are set in the Jenkins pipeline: restricted-website-build + # $1 is the list of branches to build; $2 is the list of tags to display + # So you can build from the 1.2.0 branch, but display 1.2.1 on the site + ./build_all_version.sh $1 $2 + # $3 is the default version tag for the website; $4 is the base URL ./update_all_version.sh $2 $3 $4 cd VersionedWeb tar -zcvf ../artifacts.tgz . From 05f7dd5068db6e6d51df1d8c111c3d60d016d28c Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 25 Jul 2018 10:47:23 -0700 Subject: [PATCH 2/6] using new website display argument for artifact placement in version folder --- docs/build_version_doc/build_all_version.sh | 38 +++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index 56b80e3a0fc8..e15357d502db 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -20,17 +20,22 @@ # This script is for locally building website for all versions # Built files are stored in $built -# Takes one argument: -# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master" +# Takes two arguments: +# tag list - semicolon delimited list of Github tags +# Example: "1.2.0;1.1.0;master" +# display list - semicolon delimited list of what to display on website +# Example: "1.2.1;1.1.0;master" +# The number of tags for the two arguments must be the same. # Example Usage: -# ./build_all_version.sh "1.1.0 1.0.0 master" +# ./build_all_version.sh "1.2.0;1.1.0;master" "1.2.1;1.1.0;master" +# ./build_all_version.sh "1.2.0" "1.2.1" set -e set -x if [ -z "$1" ] then - echo "Please provide a list of version tags you wish to run." + echo "Please provide a list of branches or tags you wish to build." exit 1 else IFS=$';' @@ -39,6 +44,17 @@ if [ -z "$1" ] for tag in $tag_list; do echo $tag; done fi +if [ -z "$2" ] + then + echo "Please provide a list of version tags you wish to display on the site." + exit 1 + else + IFS=$';' + tags_to_display=$2 + echo "Displaying these tags: $tags_to_display" + for tag in $tags_to_display; do echo $tag; done +fi + mxnet_url="https://github.com/apache/incubator-mxnet.git" mxnet_folder="apache_mxnet" built="VersionedWeb" @@ -53,7 +69,9 @@ if [ ! -d "$built" ]; then mkdir "$built/versions" fi -# Build all versions and use latest version(First version number in $tag_list) as landing page. +# Checkout each tag and build it +# Then store it in a folder according to the desired display tag +i=0 for tag in $tag_list; do cd "$mxnet_folder" git fetch @@ -61,8 +79,11 @@ for tag in $tag_list; do then git checkout master git pull + echo "Building master..." else - git checkout "v$tag" + # Use "v$tag" for branches or pass that in from jenkins + git checkout "$tag" + echo "Building $tag..." fi git submodule update --init --recursive || exit 1 @@ -72,12 +93,15 @@ for tag in $tag_list; do make clean make html USE_OPENMP=1 || exit 1 cd ../../ - file_loc="$built/versions/$tag" + altname=$tags_to_display[$i] + file_loc="$built/versions/$altname" if [ -d "$file_loc" ] ; then rm -rf "$file_loc" fi mkdir "$file_loc" + echo "Storing artifacts for $tag in $file_loc folder..." cp -a "$mxnet_folder/docs/_build/html/." "$file_loc" + i=$((i+1)); done echo "Now you may want to run update_all_version.sh to create the production layout with the versions dropdown and other per-version corrections." From cf54400236f8ca5b4cc06ac8f64e16270cabfe8f Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 25 Jul 2018 14:37:35 -0700 Subject: [PATCH 3/6] adding display logic --- docs/build_version_doc/build_all_version.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index e15357d502db..44cd540fda0b 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -41,7 +41,7 @@ if [ -z "$1" ] IFS=$';' tag_list=$1 echo "Using these tags: $tag_list" - for tag in $tag_list; do echo $tag; done + build_arr=($tag_list) fi if [ -z "$2" ] @@ -52,7 +52,10 @@ if [ -z "$2" ] IFS=$';' tags_to_display=$2 echo "Displaying these tags: $tags_to_display" - for tag in $tags_to_display; do echo $tag; done + display_arr=($tags_to_display) + for key in ${!build_arr[@]}; do + echo "Branch/tag ${build_arr[${key}]} will be displayed as ${display_arr[${key}]}" + done fi mxnet_url="https://github.com/apache/incubator-mxnet.git" @@ -67,12 +70,16 @@ fi if [ ! -d "$built" ]; then mkdir $built mkdir "$built/versions" + else + if [ ! -d "$built/versions" ]; then + mkdir "$built/versions" + fi fi # Checkout each tag and build it # Then store it in a folder according to the desired display tag -i=0 -for tag in $tag_list; do +for key in ${!build_arr[@]}; do + tag=${build_arr[${key}]} cd "$mxnet_folder" git fetch if [ $tag == 'master' ] @@ -93,15 +100,14 @@ for tag in $tag_list; do make clean make html USE_OPENMP=1 || exit 1 cd ../../ - altname=$tags_to_display[$i] - file_loc="$built/versions/$altname" + # Use the display tag name for the folder name + file_loc="$built/versions/${display_arr[${key}]}" if [ -d "$file_loc" ] ; then rm -rf "$file_loc" fi mkdir "$file_loc" echo "Storing artifacts for $tag in $file_loc folder..." cp -a "$mxnet_folder/docs/_build/html/." "$file_loc" - i=$((i+1)); done echo "Now you may want to run update_all_version.sh to create the production layout with the versions dropdown and other per-version corrections." From e55188bbcafa04a4f8e0c557fbf161adecc90006 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 25 Jul 2018 14:50:30 -0700 Subject: [PATCH 4/6] remove restricted setting for testing --- docs/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Jenkinsfile b/docs/Jenkinsfile index ef0755faac7c..ff645dd4da72 100644 --- a/docs/Jenkinsfile +++ b/docs/Jenkinsfile @@ -47,13 +47,13 @@ def init_git() { try { stage('Build Docs') { - node('restricted-mxnetlinux-cpu') { + node('mxnetlinux-cpu') { ws('workspace/docs') { init_git() timeout(time: max_time, unit: 'MINUTES') { sh "ci/build.py -p ubuntu_cpu --docker-registry ${env.DOCKER_CACHE_REGISTRY} --docker-build-retries 3 /work/runtime_functions.sh build_docs ${params.tags_to_build} ${params.tag_list} ${params.tag_default} ${params.domain}" archiveArtifacts 'docs/build_version_doc/artifacts.tgz' - build 'restricted-website-publish' + build 'test-website-publish' } } } @@ -62,13 +62,13 @@ try { // set build status to success at the end currentBuild.result = "SUCCESS" } catch (caughtError) { - node("restricted-mxnetlinux-cpu") { + node("mxnetlinux-cpu") { sh "echo caught ${caughtError}" err = caughtError currentBuild.result = "FAILURE" } } finally { - node("restricted-mxnetlinux-cpu") { + node("mxnetlinux-cpu") { // Only send email if master failed if (currentBuild.result == "FAILURE") { emailext body: 'Generating the website has failed. Please view the build at ${BUILD_URL}', replyTo: '${EMAIL}', subject: '[WEBSITE FAILED] Build ${BUILD_NUMBER}', to: '${EMAIL}' From a4d3cca731bcbf386891cd80064d7cc4f4539c82 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 25 Jul 2018 15:12:16 -0700 Subject: [PATCH 5/6] update usage instructions --- docs/build_version_doc/update_all_version.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/build_version_doc/update_all_version.sh b/docs/build_version_doc/update_all_version.sh index bfd656f5ae81..e39b0a503412 100755 --- a/docs/build_version_doc/update_all_version.sh +++ b/docs/build_version_doc/update_all_version.sh @@ -23,12 +23,12 @@ # the tags you want to update. # Takes three arguments: -# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master" +# * tag list - semicolon delimited list of tags to display on site; Example: "1.1.0;1.0.0;master" # * default tag - which version should the site default to; Example: 1.0.0 # * root URL - for the versions dropdown to change to production or dev server; Example: http://mxnet.incubator.apache.org/ # Example Usage: -# ./update_all_version.sh "1.1.0 1.0.0 master" 1.0.0 http://mxnet.incubator.apache.org/ +# ./update_all_version.sh "1.1.0;1.0.0;master" 1.0.0 http://mxnet.incubator.apache.org/ set -e set -x @@ -36,7 +36,6 @@ set -x MASTER_SOURCE_DIR="../../docs" STATIC_FILES_DIR="_static" MXNET_THEME_DIR="_static/mxnet-theme" -BUILD_HTML_DIR="_build/html" if [ -z "$1" ] then @@ -132,4 +131,3 @@ for tag in $tag_list; do done echo "The output of this process can be found in the VersionedWeb folder." - From c24ce4c91571fa8694b1d25943b6918f44352416 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Thu, 26 Jul 2018 09:35:17 -0700 Subject: [PATCH 6/6] reverted Jenkinsfile to use restricted nodes --- docs/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Jenkinsfile b/docs/Jenkinsfile index ff645dd4da72..ef0755faac7c 100644 --- a/docs/Jenkinsfile +++ b/docs/Jenkinsfile @@ -47,13 +47,13 @@ def init_git() { try { stage('Build Docs') { - node('mxnetlinux-cpu') { + node('restricted-mxnetlinux-cpu') { ws('workspace/docs') { init_git() timeout(time: max_time, unit: 'MINUTES') { sh "ci/build.py -p ubuntu_cpu --docker-registry ${env.DOCKER_CACHE_REGISTRY} --docker-build-retries 3 /work/runtime_functions.sh build_docs ${params.tags_to_build} ${params.tag_list} ${params.tag_default} ${params.domain}" archiveArtifacts 'docs/build_version_doc/artifacts.tgz' - build 'test-website-publish' + build 'restricted-website-publish' } } } @@ -62,13 +62,13 @@ try { // set build status to success at the end currentBuild.result = "SUCCESS" } catch (caughtError) { - node("mxnetlinux-cpu") { + node("restricted-mxnetlinux-cpu") { sh "echo caught ${caughtError}" err = caughtError currentBuild.result = "FAILURE" } } finally { - node("mxnetlinux-cpu") { + node("restricted-mxnetlinux-cpu") { // Only send email if master failed if (currentBuild.result == "FAILURE") { emailext body: 'Generating the website has failed. Please view the build at ${BUILD_URL}', replyTo: '${EMAIL}', subject: '[WEBSITE FAILED] Build ${BUILD_NUMBER}', to: '${EMAIL}'