Skip to content

Commit 6979dfd

Browse files
authored
support excluded api files (#11)
Signed-off-by: 佑祎 <[email protected]>
1 parent de57f94 commit 6979dfd

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if you have new features to develop. API Changes will be synced to `koordinator-
2121
To update Koordinator API repo.
2222
1. (optional) add more api directories to clone, append source and destination to API_PATHS_MAP in clone-api-files.sh
2323
```shell script
24-
# vim hack/clone-api-files.sh
24+
# vim hack/api-files.sh
2525
API_PATHS_MAP=(
2626
"apis/slo:slo"
2727
)

hack/api-files.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Define the relative path of API src and dst
4+
API_PATHS_MAP=(
5+
"apis/analysis:analysis"
6+
"apis/config:config"
7+
"apis/configuration:configuration"
8+
"apis/extension:extension"
9+
"apis/quota:quota"
10+
"apis/runtime:runtime"
11+
"apis/scheduling:scheduling"
12+
"apis/scheme:scheme"
13+
"apis/slo:slo"
14+
"apis/thirdparty:thirdparty"
15+
)
16+
17+
# Define files in apis should be excluded
18+
EXCLUDED_PATHS=(
19+
#"apis/extension/xxx/"
20+
)

hack/clone-api-files.sh

+18-15
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22

33
set -e
44

5-
# Define the relative path of API src and dst
6-
API_PATHS_MAP=(
7-
"apis/analysis:analysis"
8-
"apis/config:config"
9-
"apis/configuration:configuration"
10-
"apis/extension:extension"
11-
"apis/quota:quota"
12-
"apis/runtime:runtime"
13-
"apis/scheduling:scheduling"
14-
"apis/scheme:scheme"
15-
"apis/slo:slo"
16-
"apis/thirdparty:thirdparty"
17-
)
5+
API_MAP_FILE_DIR=$( cd $(dirname $0); pwd )
6+
API_MAP_FILE_PATH="${API_MAP_FILE_DIR}/api-files.sh"
7+
source ${API_MAP_FILE_PATH}
188

199
help() {
2010
echo "command format error, usage example"
2111
echo "$0 \${koordinator_version_tag}"
2212
}
2313

24-
KOORDINATOR_REPO="https://github.com/koordinator-sh/koordinator.git"
14+
KOORDINATOR_REPO=${ENV_KOORDINATOR_REPO}
15+
16+
if [ -z "${KOORDINATOR_REPO}" ]; then
17+
KOORDINATOR_REPO="https://github.com/koordinator-sh/koordinator.git"
18+
fi
19+
2520
VERSION_TAG="$1"
2621
if [[ -z ${VERSION_TAG} ]]; then
2722
help
@@ -81,6 +76,14 @@ function remove_outdated_api_files() {
8176
done
8277
}
8378

79+
echo ">> remove excluded files from ${KOORDINATOR_REPO_DIR}"
80+
for excluded_path in "${EXCLUDED_PATHS[@]}";
81+
do
82+
rm_path="${KOORDINATOR_REPO_DIR}/${excluded_path}"
83+
rm -rf ${rm_path}
84+
echo ">> remove excluded file" ${rm_path}
85+
done
86+
8487
API_REPO_DIR=$( cd $(dirname $0)/..; pwd )
8588

8689
echo ">> copy apis files from" ${KOORDINATOR_REPO_DIR}
@@ -90,4 +93,4 @@ do
9093
dst_relative_path="${api_path_pair##*:}"
9194
copy_api_files ${KOORDINATOR_REPO_DIR}/${src_relative_path} ${API_REPO_DIR}/${dst_relative_path}
9295
remove_outdated_api_files ${KOORDINATOR_REPO_DIR}/${src_relative_path} ${API_REPO_DIR}/${dst_relative_path}
93-
done
96+
done

0 commit comments

Comments
 (0)