You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/08/10 08:17:58 UTC

[dolphinscheduler-website] branch master updated: [impv] Allow change config by env variable run prepare_docs.sh (#818)

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

zhongjiajie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ca3548ff [impv] Allow change config by env variable run prepare_docs.sh (#818)
8ca3548ff is described below

commit 8ca3548ff4cd7ae2977eabc04c9367c64c2ca009
Author: Jiajie Zhong <zh...@gmail.com>
AuthorDate: Wed Aug 10 16:17:53 2022 +0800

    [impv] Allow change config by env variable run prepare_docs.sh (#818)
    
    This patch allows user change the default setting from environment variable, which
    make change easier
---
 HOW_PREPARE_WOKR.md     | 23 ++++++++++++++++++++++-
 scripts/conf.sh         | 18 ++++++++++--------
 scripts/prepare_docs.sh |  8 ++++----
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/HOW_PREPARE_WOKR.md b/HOW_PREPARE_WOKR.md
index 7ad83ef9e..6b11f6002 100644
--- a/HOW_PREPARE_WOKR.md
+++ b/HOW_PREPARE_WOKR.md
@@ -51,4 +51,25 @@ declare -A DEV_RELEASE_DOCS_VERSIONS=(
   ["10.0.0"]="10.0.0-release"
   ...
 )
-```
\ No newline at end of file
+```
+
+## How to Change Document Build Configuration Like Organization or Branch
+
+All the configurations is in [conf.sh](./scripts/conf.sh), and their can be change by environment variable. For example, you can point
+documentation source file to your fork of [apache/dolphinscheudler](https://github.com/apache/dolphinscheduler) when you add some change
+and want to start website locally for testing, you can run below command to change `./script/prepare_docs.sh` behavior.
+
+```shell
+# your github id already fork apache/dolphinscheduler
+export PROJECT_ORG="<YOUR-GITHUB-ID>"
+# the branch name you want to fetch and deploy website's document
+export PROJECT_BRANCH_NAME="<DEPLOY-BRANCH-OF-FORK>"
+```
+
+After you export the environment, you can fetch the document source markdown file from `<YOUR-GITHUB-ID>/dolphinscheduler` branch
+`<DEPLOY-BRANCH-OF-FORK>`. it is useful when you try to test your local change before merging to apache/dolphinscheudler. For all
+parameter can set from environment you can see in [conf.sh](./scripts/conf.sh)
+
+> NOTE: You have to make sure the branch config named with `DEV_RELEASE_DOCS_VERSIONS` in [conf.sh](./scripts/conf.sh) exist in your
+> fork, when you try to deploy or test base on your fork instead of official repo. You can rebase to apache/dolphinscheduler and then
+> run `git push <REMOTE> --all` to push all barnacles to your fork.
diff --git a/scripts/conf.sh b/scripts/conf.sh
index 95fdb21da..c16e948a7 100644
--- a/scripts/conf.sh
+++ b/scripts/conf.sh
@@ -18,16 +18,18 @@
 # under the License.
 
 # Codebase Repository
-PROJECT_NAME="dolphinscheduler"
-PROJECT_BRANCH_NAME="dev"
-PROJECT_WEBSITE_NAME="${PROJECT_NAME}-website"
-PROJECT_WEBSITE_BRANCH_NAME="history-docs"
+PROJECT_ORG=${PROJECT_ORG:-apache}
+PROJECT_NAME=${PROJECT_NAME:-dolphinscheduler}
+PROJECT_BRANCH_NAME=${PROJECT_BRANCH_NAME:-dev}
+PROJECT_WEBSITE_ORG=${PROJECT_WEBSITE_ORG:-apache}
+PROJECT_WEBSITE_NAME=${PROJECT_WEBSITE_NAME:-${PROJECT_NAME}-website}
+PROJECT_WEBSITE_BRANCH_NAME=${PROJECT_WEBSITE_BRANCH_NAME:-history-docs}
 
 # Repository Website(current) Directory And Files
-SWAP_DIR="${SOURCE_PATH}/swap"
-PROJECT_SITE_DOC_DIR="${SOURCE_PATH}/docs"
-PROJECT_DIR="${SWAP_DIR}/${PROJECT_NAME}"
-PROJECT_WEBSITE_DIR="${SWAP_DIR}/${PROJECT_WEBSITE_NAME}"
+SWAP_DIR=${SWAP_DIR:-${SOURCE_PATH}/swap}
+PROJECT_SITE_DOC_DIR=${PROJECT_SITE_DOC_DIR:-${SOURCE_PATH}/docs}
+PROJECT_DIR=${PROJECT_DIR:-${SWAP_DIR}/${PROJECT_NAME}}
+PROJECT_WEBSITE_DIR=${PROJECT_WEBSITE_DIR:-${SWAP_DIR}/${PROJECT_WEBSITE_NAME}}
 
 # docs in apache/dolphinscheduler-webstie branch `history-docs`
 declare -a HISTORY_DOCS_VERSIONS=(
diff --git a/scripts/prepare_docs.sh b/scripts/prepare_docs.sh
index a46c5291a..051badc19 100755
--- a/scripts/prepare_docs.sh
+++ b/scripts/prepare_docs.sh
@@ -27,11 +27,11 @@ source "${SOURCE_PATH}/scripts/conf.sh"
 # run command `export PROTOCOL_MODE=ssh` in terminal change protocol to SSH which in is faster and stable in many cases,
 # such as local development where we already have RSA public key.
 if [ "${PROTOCOL_MODE:-HTTP}" == "ssh" ]; then
-    PROJECT_REPO="git@github.com:apache/${PROJECT_NAME}.git"
-    PROJECT_WEBSITE_REPO="git@github.com:apache/${PROJECT_WEBSITE_NAME}.git"
+    PROJECT_REPO="git@github.com:${PROJECT_ORG}/${PROJECT_NAME}.git"
+    PROJECT_WEBSITE_REPO="git@github.com:${PROJECT_WEBSITE_ORG}/${PROJECT_WEBSITE_NAME}.git"
 else
-    PROJECT_REPO="https://github.com/apache/${PROJECT_NAME}.git"
-    PROJECT_WEBSITE_REPO="https://github.com/apache/${PROJECT_WEBSITE_NAME}.git"
+    PROJECT_REPO="https://github.com/${PROJECT_ORG}/${PROJECT_NAME}.git"
+    PROJECT_WEBSITE_REPO="https://github.com/${PROJECT_WEBSITE_ORG}/${PROJECT_WEBSITE_NAME}.git"
 fi
 
 ##############################################################