This is an automated email from the ASF dual-hosted git repository.

dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 391d830  [release] Fix, update superset docs process (#8680)
391d830 is described below

commit 391d8303cbacf207f83a31f6020099523121d9e4
Author: Daniel Vaz Gaspar <danielvazgas...@gmail.com>
AuthorDate: Tue Dec 3 09:37:33 2019 +0000

    [release] Fix, update superset docs process (#8680)
    
    Introduces some automation on superset doc's build using docker
---
 .../{set_release_env.sh => Dockerfile.make_docs}   | 31 +++++-------
 RELEASING/README.md                                | 28 ++++-------
 RELEASING/make_docs.sh                             | 55 ++++++++++++++++++++++
 ...{set_release_env.sh => make_docs_entrypoint.sh} | 26 +++-------
 RELEASING/set_release_env.sh                       |  1 +
 5 files changed, 82 insertions(+), 59 deletions(-)

diff --git a/RELEASING/set_release_env.sh b/RELEASING/Dockerfile.make_docs
old mode 100755
new mode 100644
similarity index 50%
copy from RELEASING/set_release_env.sh
copy to RELEASING/Dockerfile.make_docs
index 4e4423b..829fa75
--- a/RELEASING/set_release_env.sh
+++ b/RELEASING/Dockerfile.make_docs
@@ -1,4 +1,3 @@
-#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -15,24 +14,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-usage() {
-   echo "usage: . set_release_env.sh <SUPERSET_VERSION> <SUPERSET_RC> 
<PGP_KEY_FULLBANE>"
-}
+FROM python:3.6-jessie
+ARG VERSION
 
-if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
-  usage;
-else
-  export SUPERSET_VERSION="${1}"
-  export SUPERSET_RC="${2}"
-  export SUPERSET_PGP_FULLNAME="${3}"
-  export SUPERSET_VERSION_RC="${SUPERSET_VERSION}rc${SUPERSET_RC}"
-  export SUPERSET_RELEASE=apache-superset-incubating-"${SUPERSET_VERSION}"
-  export 
SUPERSET_RELEASE_RC=apache-superset-incubating-"${SUPERSET_VERSION_RC}"
-  export SUPERSET_RELEASE_TARBALL="${SUPERSET_RELEASE}"-source.tar.gz
-  export SUPERSET_RELEASE_RC_TARBALL="${SUPERSET_RELEASE_RC}"-source.tar.gz
+RUN git clone --depth 1 --branch ${VERSION} 
https://github.com/apache/incubator-superset.git /superset
+WORKDIR /superset
+# install doc dependencies
+RUN pip install -r requirements.txt \
+    && pip install -r docs/requirements.txt
+# build the docs
+RUN python setup.py build_sphinx
 
-  echo -------------------------------
-  echo Set Release env variables
-  env | grep SUPERSET
-  echo -------------------------------
-fi
+COPY make_docs_entrypoint.sh /entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/RELEASING/README.md b/RELEASING/README.md
index a94159b..ddadfe9 100644
--- a/RELEASING/README.md
+++ b/RELEASING/README.md
@@ -303,26 +303,14 @@ Every once in a while we want to compile the 
documentation and publish it.
 Here's how to do it.
 
 ```bash
-# install doc dependencies
-pip install -r docs/requirements.txt
-
-# build the docs
-python setup.py build_sphinx
-
-# copy html files to temp folder
-cp -r docs/_build/html/ /tmp/tmp_superset_docs/
-
-# clone the docs repo
-cd ~/
-git clone https://git-wip-us.apache.org/repos/asf/incubator-superset-site.git
+./make_docs.sh
+```
 
-# copy
-cp -r /tmp/tmp_superset_docs/ ~/incubator-superset-site.git/
+Superset documentation site is ready at http://localhost:5002
 
-# commit and push to `asf-site` branch
-cd ~/incubator-superset-site.git/
-git checkout asf-site
-git add .
-git commit -a -m "New doc version"
-git push origin master
+```
+$ cd /tmp/incubator-superset-site-${SUPERSET_VERSION}
+$ git add .
+$ git commit -a -m "New doc version ${SUPERSET_VERSION}"
+$ git push origin asf-site
 ```
diff --git a/RELEASING/make_docs.sh b/RELEASING/make_docs.sh
new file mode 100755
index 0000000..118161f
--- /dev/null
+++ b/RELEASING/make_docs.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+set -e
+
+DOCKER_TMP_ASF_SITE_PATH=/asf-site
+DOC_SITE_PORT=5002
+
+# Clean tmp dir
+if [[ -d "${SUPERSET_TMP_ASF_SITE_PATH}" ]]; then
+  rm -rf "${SUPERSET_TMP_ASF_SITE_PATH}"
+fi
+mkdir -p "${SUPERSET_TMP_ASF_SITE_PATH}"
+
+# Building docker that will help update superset asf-site
+docker build --no-cache -t apache-docs \
+       --build-arg VERSION="${SUPERSET_VERSION}" \
+       -f Dockerfile.make_docs .
+
+# Running docker to update superset asf-site
+docker run \
+      -v "${SUPERSET_TMP_ASF_SITE_PATH}":"${DOCKER_TMP_ASF_SITE_PATH}":rw \
+      -e HOST_UID=${UID} \
+      -p ${DOC_SITE_PORT}:8000 \
+      -d \
+      -ti apache-docs
+
+RESULT=$?
+if [ $RESULT -ne 0 ]; then
+  echo Updating and launching documentation site failed
+  echo tip: Check if other container is using port:$DOC_SITE_PORT
+  exit 1
+fi
+
+echo "---------------------------------------------------"
+echo Superset documentation site is ready at http://localhost:5002
+echo Check it out and if all looks good:
+echo $ cd "${SUPERSET_TMP_ASF_SITE_PATH}"
+echo $ git add .
+echo $ git commit -a -m \"New doc version "${SUPERSET_VERSION}"\"
+echo $ git push origin asf-site
diff --git a/RELEASING/set_release_env.sh b/RELEASING/make_docs_entrypoint.sh
similarity index 50%
copy from RELEASING/set_release_env.sh
copy to RELEASING/make_docs_entrypoint.sh
index 4e4423b..b8b4aae 100755
--- a/RELEASING/set_release_env.sh
+++ b/RELEASING/make_docs_entrypoint.sh
@@ -15,24 +15,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-usage() {
-   echo "usage: . set_release_env.sh <SUPERSET_VERSION> <SUPERSET_RC> 
<PGP_KEY_FULLBANE>"
-}
+set -e
+git clone --branch asf-site 
https://git-wip-us.apache.org/repos/asf/incubator-superset-site.git /asf-site
 
-if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
-  usage;
-else
-  export SUPERSET_VERSION="${1}"
-  export SUPERSET_RC="${2}"
-  export SUPERSET_PGP_FULLNAME="${3}"
-  export SUPERSET_VERSION_RC="${SUPERSET_VERSION}rc${SUPERSET_RC}"
-  export SUPERSET_RELEASE=apache-superset-incubating-"${SUPERSET_VERSION}"
-  export 
SUPERSET_RELEASE_RC=apache-superset-incubating-"${SUPERSET_VERSION_RC}"
-  export SUPERSET_RELEASE_TARBALL="${SUPERSET_RELEASE}"-source.tar.gz
-  export SUPERSET_RELEASE_RC_TARBALL="${SUPERSET_RELEASE_RC}"-source.tar.gz
+# copy html files to temp folder
+cp -rv /superset/docs/_build/html/* /asf-site
+chown -R ${HOST_UID}:${HOST_UID} /asf-site
 
-  echo -------------------------------
-  echo Set Release env variables
-  env | grep SUPERSET
-  echo -------------------------------
-fi
+cd /asf-site
+python -m http.server
diff --git a/RELEASING/set_release_env.sh b/RELEASING/set_release_env.sh
index 4e4423b..8c87874 100755
--- a/RELEASING/set_release_env.sh
+++ b/RELEASING/set_release_env.sh
@@ -30,6 +30,7 @@ else
   export 
SUPERSET_RELEASE_RC=apache-superset-incubating-"${SUPERSET_VERSION_RC}"
   export SUPERSET_RELEASE_TARBALL="${SUPERSET_RELEASE}"-source.tar.gz
   export SUPERSET_RELEASE_RC_TARBALL="${SUPERSET_RELEASE_RC}"-source.tar.gz
+  export 
SUPERSET_TMP_ASF_SITE_PATH="/tmp/incubator-superset-site-${SUPERSET_VERSION}"
 
   echo -------------------------------
   echo Set Release env variables

Reply via email to