forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-34045][ci] Refactors docs creation scripts
Merges all the logic for building docs into a single file ./docs/build_docs.sh.
- Loading branch information
Showing
7 changed files
with
185 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env 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. | ||
################################################################################ | ||
|
||
function install_hugo { | ||
local hugo_version hugo_binary_arch hugo_artifact hugo_download_url install_dir | ||
|
||
hugo_version="$1" | ||
hugo_binary_arch="Linux-64bit" | ||
|
||
hugo_artifact="hugo_extended_${hugo_version}_${hugo_binary_arch}.tar.gz" | ||
hugo_download_url="https://github.com/gohugoio/hugo/releases/download/v${hugo_version}/${hugo_artifact}" | ||
if ! curl --silent --fail -OL "${hugo_download_url}" ; then | ||
echo "Failed to download Hugo ${hugo_version} binary" | ||
exit 1 | ||
fi | ||
|
||
install_dir="/usr/local/bin" | ||
tar -zxf "${hugo_artifact}" -C "${install_dir}" | ||
echo "[INFO] Hugo (v${hugo_version}) installed to '${install_dir}'." | ||
rm "${hugo_artifact}" | ||
} | ||
|
||
function load_connector_docs { | ||
local connector_name ref temp_dir theme_dir | ||
connector_name=$1 | ||
ref=$2 | ||
temp_dir=$3 | ||
theme_dir=$4 | ||
|
||
pushd "${temp_dir}" || exit | ||
git clone --single-branch --branch "${ref}" "https://github.com/apache/flink-connector-${connector_name}" | ||
rsync -a flink-connector-${connector_name}/docs/* "${theme_dir}/" | ||
popd || exit | ||
} | ||
|
||
function load_connector_docs_from_file { | ||
local config_file temp_dir theme_dir | ||
|
||
config_file="$1" | ||
temp_dir="$2" | ||
theme_dir="$3" | ||
|
||
rm -rf "${theme_dir}" | ||
mkdir -p "${theme_dir}" | ||
|
||
rm -rf "${temp_dir}" | ||
mkdir -p "${temp_dir}" | ||
|
||
while read -r line; do | ||
if [[ "${line}" =~ ^# ]] || [[ "${line}" =~ ^[^a-zA-Z]*$ ]]; then | ||
# skip comments or empty lines | ||
continue | ||
fi | ||
|
||
connector_name="$(echo $line | cut -d' ' -f1)" | ||
ref="$(echo $line | cut -d' ' -f2)" | ||
load_connector_docs "${connector_name}" "${ref}" "${temp_dir}" "${theme_dir}" | ||
done < "${config_file}" | ||
} | ||
|
||
function assert_hugo_installation { | ||
local expected_hugo_version | ||
expected_hugo_version="${1}" | ||
if ! which hugo &> /dev/null ; then | ||
echo "[ERROR] No hugo binaries installed." | ||
exit 1 | ||
elif [[ "$(hugo version | grep -c "hugo v${expected_hugo_version}")" == 0 ]]; then | ||
echo "[ERROR] Invalid Hugo version installed: (expected ${expected_hugo_version}):" | ||
hugo version | ||
exit 1 | ||
fi | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters