[release] Fix, update superset docs process (#8680)

Introduces some automation on superset doc's build using docker
This commit is contained in:
Daniel Vaz Gaspar 2019-12-03 09:37:33 +00:00 committed by GitHub
parent 4e998be695
commit 391d8303cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 22 deletions

View File

@ -0,0 +1,29 @@
#
# 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.
#
FROM python:3.6-jessie
ARG VERSION
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
COPY make_docs_entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -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
# copy
cp -r /tmp/tmp_superset_docs/ ~/incubator-superset-site.git/
# 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
./make_docs.sh
```
Superset documentation site is ready at http://localhost:5002
```
$ cd /tmp/incubator-superset-site-${SUPERSET_VERSION}
$ git add .
$ git commit -a -m "New doc version ${SUPERSET_VERSION}"
$ git push origin asf-site
```

55
RELEASING/make_docs.sh Executable file
View File

@ -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

View File

@ -0,0 +1,26 @@
#!/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
git clone --branch asf-site https://git-wip-us.apache.org/repos/asf/incubator-superset-site.git /asf-site
# copy html files to temp folder
cp -rv /superset/docs/_build/html/* /asf-site
chown -R ${HOST_UID}:${HOST_UID} /asf-site
cd /asf-site
python -m http.server

View File

@ -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