You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by da...@apache.org on 2022/12/05 11:09:43 UTC

[flink] 01/02: [FLINK-27394][Documentation][Buildsystem] Update build pipeline to get latest documentation from external connector repository

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

dannycranmer pushed a commit to branch release-1.15
in repository https://gitbox.apache.org/repos/asf/flink.git

commit bca523872b9a24b356a7769c00293c48d11fa1e9
Author: MartijnVisser <ma...@apache.org>
AuthorDate: Mon Apr 25 13:35:51 2022 +0200

    [FLINK-27394][Documentation][Buildsystem] Update build pipeline to get latest documentation from external connector repository
---
 .github/workflows/docs.sh                   |  7 +++++++
 azure-pipelines.yml                         |  3 +++
 docs/build_docs.sh                          |  3 ++-
 tools/ci/docs.sh => docs/setup_docs.sh      | 32 +++++++++++++++++------------
 tools/azure-pipelines/build-apache-repo.yml |  6 ++++++
 tools/ci/docs.sh                            |  6 +++++-
 6 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/docs.sh b/.github/workflows/docs.sh
index fa0fd21bd6d..bb83d318ac9 100755
--- a/.github/workflows/docs.sh
+++ b/.github/workflows/docs.sh
@@ -31,6 +31,13 @@ if ! curl --fail -OL $HUGO_REPO ; then
 fi
 tar -zxvf $HUGO_ARTIFACT
 git submodule update --init --recursive
+# Setup the external documentation modules
+cd docs
+source setup_docs.sh
+cd ..
+# Build the docs
+./hugo --source docs
+
 # generate docs into docs/target
 ./hugo -v --source docs --destination target
 if [ $? -ne 0 ]; then
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 649643ff170..ccd50af9ba3 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -85,6 +85,9 @@ stages:
         pool:
           vmImage: 'ubuntu-20.04'
         steps:
+          - task: GoTool@0
+            inputs:
+              version: '1.18.1'
           - script: ./tools/ci/docs.sh
   # CI / Special stage for release, e.g. building PyFlink wheel packages, etc:
   - stage: ci_release
diff --git a/docs/build_docs.sh b/docs/build_docs.sh
index 36eba0cc2de..80f7d0e2515 100755
--- a/docs/build_docs.sh
+++ b/docs/build_docs.sh
@@ -24,5 +24,6 @@ then
 	exit 1
 fi
 git submodule update --init --recursive
-
+./setup_docs.sh
+hugo mod get -u
 hugo -b "" serve 
diff --git a/tools/ci/docs.sh b/docs/setup_docs.sh
similarity index 55%
copy from tools/ci/docs.sh
copy to docs/setup_docs.sh
index e089170cb1b..01230c1c7a2 100755
--- a/tools/ci/docs.sh
+++ b/docs/setup_docs.sh
@@ -17,21 +17,27 @@
 # limitations under the License.
 ################################################################################
 
-HUGO_REPO=https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.tar.gz
-HUGO_ARTIFACT=hugo_extended_0.80.0_Linux-64bit.tar.gz
-
-if ! curl --fail -OL $HUGO_REPO ; then 
-	echo "Failed to download Hugo binary"
-	exit 1
+HERE=` basename "$PWD"`
+if [[ "$HERE" != "docs" ]]; then
+    echo "Please only execute in the docs/ directory";
+    exit 1;
 fi
 
-tar -zxvf $HUGO_ARTIFACT
+# Create a default go.mod file
+cat <<EOF >go.mod
+module github.com/apache/flink
 
-git submodule update --init --recursive
-./hugo --source docs
+go 1.18
+EOF
 
-if [ $? -ne 0 ]; then
-	echo "Error building the docs"
-	exit 1
-fi
+echo "Created temporary file" $goModFileLocation/go.mod
 
+# Make Hugo retrieve modules which are used for externally hosted documentation
+currentBranch=$(git branch --show-current)
+
+if [[ ! "$currentBranch" =~ ^release- ]] || [[ -z "$currentBranch" ]]; then
+  # If the current branch is master or not provided, get the documentation from the main branch
+  $(command -v hugo) mod get -u github.com/apache/flink-connector-elasticsearch/docs@main
+  # Since there's no documentation yet available for a release branch,
+  # we only get the documentation from the main branch
+fi
diff --git a/tools/azure-pipelines/build-apache-repo.yml b/tools/azure-pipelines/build-apache-repo.yml
index 924bfa67547..293dea7d2a7 100644
--- a/tools/azure-pipelines/build-apache-repo.yml
+++ b/tools/azure-pipelines/build-apache-repo.yml
@@ -79,6 +79,9 @@ stages:
           vmImage: 'ubuntu-20.04'
         steps:
           # Skip docs check if this is a pull request that doesn't contain a documentation change
+          - task: GoTool@0
+            inputs:
+              version: '1.18.1'
           - bash: |
               source ./tools/azure-pipelines/build_properties.sh
               pr_contains_docs_changes
@@ -151,6 +154,9 @@ stages:
         pool:
           vmImage: 'ubuntu-20.04'
         steps:
+          - task: GoTool@0
+            inputs:
+              version: '1.18.1'
           - script: ./tools/ci/docs.sh
       - template: build-python-wheels.yml
         parameters:
diff --git a/tools/ci/docs.sh b/tools/ci/docs.sh
index e089170cb1b..37be99246ae 100755
--- a/tools/ci/docs.sh
+++ b/tools/ci/docs.sh
@@ -28,10 +28,14 @@ fi
 tar -zxvf $HUGO_ARTIFACT
 
 git submodule update --init --recursive
+# Setup the external documentation modules
+cd docs
+source setup_docs.sh
+cd ..
+# Build the docs
 ./hugo --source docs
 
 if [ $? -ne 0 ]; then
 	echo "Error building the docs"
 	exit 1
 fi
-