Skip to content

Commit 7d7ec1c

Browse files
tamalsahabrendandburns
authored andcommitted
Allow specifying a github repository if working on ecosystem projects (#63)
1 parent 55f9ae0 commit 7d7ec1c

11 files changed

+20
-4
lines changed

openapi/client-generator.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ kubeclient::generator::generate_client() {
4141

4242
SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT:-v2.2.3}"
4343
USERNAME="${USERNAME:-kubernetes}"
44+
REPOSITORY="${REPOSITORY:-kubernetes}"
4445

4546
local output_dir=$1
4647
pushd "${output_dir}" > /dev/null
@@ -55,9 +56,9 @@ kubeclient::generator::generate_client() {
5556

5657
echo "--- Building docker image..."
5758
if [ "${USERNAME}" != "kubernetes" ]; then
58-
image_name="kubernetes-${USERNAME}-${CLIENT_LANGUAGE}-client-gen:v1"
59+
image_name="${USERNAME}-${REPOSITORY}-${CLIENT_LANGUAGE}-client-gen:v1"
5960
else
60-
image_name="kubernetes-${CLIENT_LANGUAGE}-client-gen:v1"
61+
image_name="${REPOSITORY}-${CLIENT_LANGUAGE}-client-gen:v1"
6162
fi
6263
docker build "${SCRIPT_ROOT}" -t "${image_name}" \
6364
--build-arg SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT}" \
@@ -76,6 +77,7 @@ kubeclient::generator::generate_client() {
7677
-e PACKAGE_NAME="${PACKAGE_NAME}" \
7778
-e SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT}" \
7879
-e USERNAME="${USERNAME}" \
80+
-e REPOSITORY="${REPOSITORY}" \
7981
-v "${output_dir}:/output_dir" \
8082
"${image_name}" "/output_dir"
8183

openapi/csharp.sh

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if [ $# -ne 2 ]; then
2828
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2929
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
3030
echo " Setting file can define an optional USERNAME if you're working on a fork"
31+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
3132
exit 1
3233
fi
3334

openapi/generate_client_in_container.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ popd
7979
mkdir -p "${output_dir}"
8080

8181
echo "--- Downloading and pre-processing OpenAPI spec"
82-
python "${SCRIPT_ROOT}/preprocess_spec.py" "${CLIENT_LANGUAGE}" "${KUBERNETES_BRANCH}" "${output_dir}/swagger.json" "${USERNAME}"
82+
python "${SCRIPT_ROOT}/preprocess_spec.py" "${CLIENT_LANGUAGE}" "${KUBERNETES_BRANCH}" "${output_dir}/swagger.json" "${USERNAME}" "${REPOSITORY}"
8383

8484
echo "--- Cleaning up previously generated folders"
8585
for i in ${CLEANUP_DIRS}; do

openapi/go.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

openapi/haskell.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

openapi/java.sh

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if [ $# -ne 2 ]; then
2828
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2929
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
3030
echo " Setting file can define an optional USERNAME if you're working on a fork"
31+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
3132
exit 1
3233
fi
3334

openapi/javascript.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

openapi/preprocess_spec.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,16 @@ def main():
302302
help='Optional username if working on forks',
303303
default='kubernetes'
304304
)
305+
argparser.add_argument(
306+
'repository',
307+
help='Optional repository name if working with kubernetes ecosystem projects',
308+
default='kubernetes'
309+
)
305310
args = argparser.parse_args()
306311

307-
spec_url = 'https://raw.githubusercontent.com/%s/kubernetes/' \
312+
spec_url = 'https://raw.githubusercontent.com/%s/%s/' \
308313
'%s/api/openapi-spec/swagger.json' % (args.username,
314+
args.repository,
309315
args.kubernetes_branch)
310316

311317
pool = urllib3.PoolManager()

openapi/python.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

openapi/ruby.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

openapi/typescript.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
2525
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
2626
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
2727
echo " Setting file can define an optional USERNAME if you're working on a fork"
28+
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
2829
exit 1
2930
fi
3031

0 commit comments

Comments
 (0)