Skip to content

Commit d830fe9

Browse files
committed
add -f argument which will override check for CI environment variable
1 parent 6d38162 commit d830fe9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/copy-clickhouse-repo-docs.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
#!/bin/bash
22

33
function parse_args() {
4+
force_pull=false
45

5-
while getopts "hl:" opt; do
6+
while getopts "hl:f" opt; do
67
case "$opt" in
78
h)
89
# Display the usage information and exit when -h is provided
9-
echo "Usage: $0 [-l path_to_local_clickhouse_repo]"
10+
echo "Usage: $0 [-l path_to_local_clickhouse_repo] [-f]"
1011
echo ""
1112
echo "Options:"
1213
echo " -l Path to a local copy of the ClickHouse repository."
14+
echo " -f Force pull from GitHub even in CI environment."
1315
echo " -h Display this help message."
1416
exit 0
1517
;;
1618
l)
1719
local_path="$OPTARG"
1820
;;
21+
f)
22+
force_pull=true
23+
;;
1924
\?)
2025
echo "Invalid option: -$OPTARG" >&2
2126
exit 1
2227
;;
2328
esac
2429
done
25-
26-
echo "$local_path"
2730
}
2831

2932
# Copy files/folders using rsync (or fallback to cp)
@@ -100,10 +103,14 @@ main() {
100103

101104
if [[ -z "$local_path" ]]; then
102105

103-
if [[ "$CI" == "true" ]]; then
106+
# Check if in CI environment and force_pull is not set
107+
if [[ "$CI" == "true" && "$force_pull" == "false" ]]; then
104108
echo "CI environment detected, expecting /ClickHouse without having to pull the repo"
105109
copy_docs_locally "/ClickHouse"
106110
else
111+
if [[ "$force_pull" == "true" && "$CI" == "true" ]]; then
112+
echo "Force pull enabled, ignoring CI environment and pulling from GitHub"
113+
fi
107114
git clone --depth 1 --branch master https://github.com/ClickHouse/ClickHouse
108115
# Copy docs from cloned repository
109116
copy_docs_locally "$(pwd)/ClickHouse"

0 commit comments

Comments
 (0)