You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by fr...@apache.org on 2019/07/09 22:43:27 UTC
[calcite] 01/02: Add Jenkinsfile for automated site build
This is an automated email from the ASF dual-hosted git repository.
francischuang pushed a commit to branch test-site
in repository https://gitbox.apache.org/repos/asf/calcite.git
commit 3ee40c37dbbc527cba3c23fb2157ed692a2e4209
Author: Francis Chuang <fr...@apache.org>
AuthorDate: Sun Jun 9 15:40:40 2019 +1000
Add Jenkinsfile for automated site build
---
Jenkinsfile | 129 ++++++++++++++++++++++++++++++++++++++++++++++++
site/_config.yml | 2 +
site/docker-compose.yml | 6 ++-
3 files changed, 136 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..17d9b1f
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,129 @@
+/*
+* 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.
+*/
+pipeline {
+ agent {
+ node {
+ label 'git-websites'
+ }
+ }
+
+ environment {
+ COMPOSE_PROJECT_NAME = "${env.JOB_NAME}-${env.BUILD_ID}"
+ }
+
+ options {
+ timeout(time: 40, unit: 'MINUTES')
+ }
+
+ stages {
+ stage('Build Site') {
+ when {
+ branch 'test-site'
+ }
+ steps {
+ dir ("site") {
+ sh '''docker-compose run -d -e JEKYLL_UID=$(id -u) -e JEKYLL_GID=$(id -g) build-site
+ containerID=$(docker-compose ps -q build-site)
+
+ while $(docker inspect -f '{{.State.Running}}' $containerID) != "false"; do
+ sleep 1
+ done
+
+ docker logs $containerID
+ exit $(docker inspect -f '{{.State.ExitCode}}' $containerID)
+ '''
+ }
+ echo "Website assets built."
+ }
+ }
+
+ stage('Build Javadoc') {
+ when {
+ tag pattern: "^calcite-[\d\.]+$", comparator: "REGEXP"
+ }
+ steps {
+ dir ("site") {
+ sh '''docker-compose run -d -u $(id -u):$(id -g) generate-javadoc
+ containerID=$(docker-compose ps -q generate-javadoc)
+
+ while $(docker inspect -f '{{.State.Running}}' $containerID) != "false"; do
+ sleep 1
+ done
+
+ docker logs $containerID
+ exit $(docker inspect -f '{{.State.ExitCode}}' $containerID)
+ '''
+ }
+ echo "Javadoc built."
+ }
+ }
+
+ stage('Deploy Site') {
+ when {
+ branch 'test-site'
+ }
+ steps {
+ echo 'Deploying to git repository'
+ dir ("site") {
+ sh '''
+ shopt -s extglob
+
+ git clone --depth 1 --branch asf-site https://gitbox.apache.org/repos/asf/calcite-site.git deploy
+ cd deploy/
+
+ rm -rf !(apidocs|avatica|testapidocs)
+ cp -r ../target/* .
+
+ git add .
+ git commit -m "Automatic site deployment at $GIT_COMMIT"
+ git push origin HEAD:asf-site
+ '''
+ }
+ echo "Deployment completed."
+ }
+ }
+
+ stage('Deploy Javadoc') {
+ when {
+ tag pattern: "^calcite-[\d\.]+$", comparator: "REGEXP"
+ }
+ steps {
+ echo 'Deploying to git repository'
+ dir ("site") {
+ sh '''
+ git clone --depth 1 --branch asf-site https://gitbox.apache.org/repos/asf/calcite-site.git deploy
+ cd deploy/
+
+ rm -rf apidocs/ testapidocs/
+
+ cp -r ../target/* .
+
+ git add .
+ git commit -m "Automatic site deployment at $GIT_COMMIT"
+ git push origin HEAD:asf-site
+ '''
+ }
+ echo "Deployment completed."
+ }
+ }
+ }
+ post {
+ always {
+ sh 'docker system prune --force --all'
+ }
+ }
+}
\ No newline at end of file
diff --git a/site/_config.yml b/site/_config.yml
index 08427ff..f79761b 100644
--- a/site/_config.yml
+++ b/site/_config.yml
@@ -53,4 +53,6 @@ avaticaBaseurl: /avatica
plugins:
- jekyll-redirect-from
+future: true
+
# End _config.yml
diff --git a/site/docker-compose.yml b/site/docker-compose.yml
index 13b808c..f975655 100644
--- a/site/docker-compose.yml
+++ b/site/docker-compose.yml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-version: '3'
+version: '3.7'
services:
dev:
image: jekyll/jekyll:3
@@ -22,11 +22,15 @@ services:
- 4000:4000
volumes:
- .:/srv/jekyll
+ environment:
+ TZ: "UTC"
build-site:
image: jekyll/jekyll:3
command: jekyll build
volumes:
- .:/srv/jekyll
+ environment:
+ TZ: "UTC"
generate-javadoc:
image: maven
working_dir: /usr/src/calcite