joshfischer/asf site (#3414)
* add asf site redirect
* git-site-role commit from publish_site.sh
* updating compile docker script to run as host user
* attempting to add host user
* adding host user to docker container
* remove user flag
* add user flag back. Update path
* update path
* correcting user gropus
* modifying directory path of volume in container
* correcting npm command
* adding encoding flag to javadocs command
* comment out javadocs script
* attempting to list heronpy version
* changing environment variable name for debugging jenkins
* attempting to remove heron version from pip script
* adding back javadocs to makefile. tweaking version matrix
* flipping encoding flag
* correct javadoc path
* creating paths for java and py docs
* pivoting to use gh token
* removing duplicated htacess file
diff --git a/website2/website/scripts/Dockerfile.ubuntu18.04 b/website2/website/scripts/Dockerfile.ubuntu18.04
index 218d4c0..0f8d2c1 100644
--- a/website2/website/scripts/Dockerfile.ubuntu18.04
+++ b/website2/website/scripts/Dockerfile.ubuntu18.04
@@ -21,6 +21,7 @@
ENV TARGET_PLATFORM ubuntu
ENV bazelVersion 0.26.0
+
RUN apt-get update && apt-get -y install \
g++ \
cmake \
@@ -51,9 +52,17 @@
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ARG UNAME
+ARG UID
+ARG GID
+RUN groupadd -g $GID -o $UNAME
+RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
+USER $UNAME
+
RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
&& chmod +x /tmp/bazel.sh \
- && /tmp/bazel.sh
+ && /tmp/bazel.sh --user
-ADD bazelrc /root/.bazelrc
+ADD bazelrc /home/$UNAME/.bazelrc
+ENV PATH="/home/$UNAME/bin:${PATH}"
diff --git a/website2/website/scripts/build-site.sh b/website2/website/scripts/build-site.sh
index fea4b2a..2647259 100755
--- a/website2/website/scripts/build-site.sh
+++ b/website2/website/scripts/build-site.sh
@@ -23,17 +23,18 @@
set -x -e
cd ${ROOT_DIR}/website2/website
-#npm install yarn
-npm build
+npm install yarn
+npm run-script build
node ./scripts/replace.js
rm -rf ${ROOT_DIR}/generated-site/content
-mkdir -p ${ROOT_DIR}/generated-site/content
+mkdir -p ${ROOT_DIR}/generated-site/content/api/java
+mkdir -p ${ROOT_DIR}/generated-site/content/api/python
## copy generated site
cp -R build/incubator-heron/* ${ROOT_DIR}/generated-site/content
-## copy java docs website2/website/static/api
-cp -R ${ROOT_DIR}/website2/website/static/api/* ${ROOT_DIR}/generated-site/content/api/java/
+## copy java docs
+cp -R ${ROOT_DIR}/website2/website/public/api/java/* ${ROOT_DIR}/generated-site/content/api/java/
## copy pydocs
cp -R ${ROOT_DIR}/website2/website/static/api/python/* ${ROOT_DIR}/generated-site/content/api/python/
## remove bazelrc for dockerfile
diff --git a/website2/website/scripts/compile-docker.sh b/website2/website/scripts/compile-docker.sh
index e96ef73..2a63e91 100755
--- a/website2/website/scripts/compile-docker.sh
+++ b/website2/website/scripts/compile-docker.sh
@@ -53,11 +53,17 @@
echo $DOCKER_FILE
echo "Building heron-compiler container"
-docker build -t heron-compiler:$TARGET_PLATFORM -f $DOCKER_FILE .
+docker build \
+ --build-arg UNAME=$USER \
+ --build-arg UID=$(id -u ${USER}) \
+ --build-arg GID=$(id -g ${USER}) \
+ -t heron-compiler:$TARGET_PLATFORM -f $DOCKER_FILE .
docker run \
--rm \
- -v $PROJECT_DIR/..:/dist \
- -t heron-compiler:$TARGET_PLATFORM make -C /dist/website2/website/ buildsite
+ -u `id -u`:`id -g` \
+ -v $PROJECT_DIR/..:/home/$USER/heron \
+ -v /etc/passwd:/etc/passwd \
+ -t heron-compiler:$TARGET_PLATFORM make -C /home/$USER/heron/website2/website/ buildsite
diff --git a/website2/website/scripts/javadocs.sh b/website2/website/scripts/javadocs.sh
index 5232bbc..dfee9b8 100755
--- a/website2/website/scripts/javadocs.sh
+++ b/website2/website/scripts/javadocs.sh
@@ -59,6 +59,7 @@
export CLASSPATH=$BIN_JARS:$GEN_JARS:$SCRIBE_JARS:$PROTO_JARS:$CLOSURE_CLASSES
$JAVADOC $FLAGS \
+ -encoding "UTF-8" \
-windowtitle "Heron Java API" \
-doctitle "The Heron Java API" \
-overview $OVERVIEW_HTML_FILE \
diff --git a/website2/website/scripts/publish_site.sh b/website2/website/scripts/publish_site.sh
index 575b399..b313aba 100755
--- a/website2/website/scripts/publish_site.sh
+++ b/website2/website/scripts/publish_site.sh
@@ -16,21 +16,34 @@
# specific language governing permissions and limitations
# under the License.
+set -e
+
ROOT_DIR=$(git rev-parse --show-toplevel)
WORK_DIR=${ROOT_DIR}/generated-site/content
ME=`basename $0`
-# push all of the results to asf-site branch
-git checkout asf-site
-git clean -f -d
-git pull origin asf-site
+ORIGIN_REPO=$(git remote show origin | grep 'Push URL' | awk -F// '{print $NF}')
+echo "ORIGIN_REPO: $ORIGIN_REPO"
-rm -rf ${ROOT_DIR}/content
-mkdir ${ROOT_DIR}/content
+HERON_SITE_TMP=/tmp/heron-site
+(
-cp -a $WORK_DIR/* ${ROOT_DIR}/content
-cp -a ${ROOT_DIR}/.htaccess ${ROOT_DIR}/content
+ cd $ROOT_DIR
+ rm -rf $HERON_SITE_TMP
+ mkdir $HERON_SITE_TMP
+ cd $HERON_SITE_TMP
-git add ${ROOT_DIR}/content
-git commit -m "git-site-role commit from $ME"
-git push origin asf-site
+ git clone "https://$GH_TOKEN@$ORIGIN_REPO" .
+ git config user.name "Heron Site Updater"
+ git config user.email "dev@heron.incubator.apache.org"
+ git checkout asf-site
+
+ # copy the generated dir
+ cp -r $WORK_DIR/* $HERON_SITE_TMP/content
+ cp -a ${ROOT_DIR}/.htaccess ${ROOT_DIR}/content
+ # push all of the results to asf-site branch
+ git add -A .
+ git diff-index --quiet HEAD || (git commit -m "git-site-role commit from $ME" && git push -q origin HEAD:asf-site)
+ rm -rf $HERON_SITE_TMP
+
+)
\ No newline at end of file
diff --git a/website2/website/scripts/python-doc-gen.sh b/website2/website/scripts/python-doc-gen.sh
index 2c63ee7..5d8a7e6 100755
--- a/website2/website/scripts/python-doc-gen.sh
+++ b/website2/website/scripts/python-doc-gen.sh
@@ -18,7 +18,7 @@
set -e
-HERONPY_VERSION=$1
+TEMP_HERONPY_VERSION=$1
HERON_ROOT_DIR=$(git rev-parse --show-toplevel)
cd ${HERON_ROOT_DIR}
@@ -41,7 +41,10 @@
pip install pdoc==0.3.2
pip install --ignore-installed six
# Install the heronpy
-pip install $PIP_LOCATION/heronpy-${HERONPY_VERSION}-py2.py3-none-any.whl
+echo "list heronpy location"
+ls $PIP_LOCATION
+pip install $PIP_LOCATION/heronpy-*-py2.py3-none-any.whl
+
mkdir -p static/api && rm -rf static/api/python
diff --git a/website2/website/scripts/replace.js b/website2/website/scripts/replace.js
index a1b9cbe..7fec8bc 100755
--- a/website2/website/scripts/replace.js
+++ b/website2/website/scripts/replace.js
@@ -35,9 +35,9 @@
const latestVersion = versions[0];
const bazelVersions = {
- '0.20.0': '0.14.1',
- '0.20.1': '0.26',
- 'latest': '0.26',
+ '0.20.0-incubating': '0.14.1',
+ '0.20.1-incubating': '0.26.0',
+ 'latest': '0.26.0',
}
function replaceBazel(version) {