Allow specifying a github repository if working on ecosystem projects (#63)
This commit is contained in:
committed by
Brendan Burns
parent
55f9ae0366
commit
7d7ec1cfee
@@ -41,6 +41,7 @@ kubeclient::generator::generate_client() {
|
||||
|
||||
SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT:-v2.2.3}"
|
||||
USERNAME="${USERNAME:-kubernetes}"
|
||||
REPOSITORY="${REPOSITORY:-kubernetes}"
|
||||
|
||||
local output_dir=$1
|
||||
pushd "${output_dir}" > /dev/null
|
||||
@@ -55,9 +56,9 @@ kubeclient::generator::generate_client() {
|
||||
|
||||
echo "--- Building docker image..."
|
||||
if [ "${USERNAME}" != "kubernetes" ]; then
|
||||
image_name="kubernetes-${USERNAME}-${CLIENT_LANGUAGE}-client-gen:v1"
|
||||
image_name="${USERNAME}-${REPOSITORY}-${CLIENT_LANGUAGE}-client-gen:v1"
|
||||
else
|
||||
image_name="kubernetes-${CLIENT_LANGUAGE}-client-gen:v1"
|
||||
image_name="${REPOSITORY}-${CLIENT_LANGUAGE}-client-gen:v1"
|
||||
fi
|
||||
docker build "${SCRIPT_ROOT}" -t "${image_name}" \
|
||||
--build-arg SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT}" \
|
||||
@@ -76,6 +77,7 @@ kubeclient::generator::generate_client() {
|
||||
-e PACKAGE_NAME="${PACKAGE_NAME}" \
|
||||
-e SWAGGER_CODEGEN_COMMIT="${SWAGGER_CODEGEN_COMMIT}" \
|
||||
-e USERNAME="${USERNAME}" \
|
||||
-e REPOSITORY="${REPOSITORY}" \
|
||||
-v "${output_dir}:/output_dir" \
|
||||
"${image_name}" "/output_dir"
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ popd
|
||||
mkdir -p "${output_dir}"
|
||||
|
||||
echo "--- Downloading and pre-processing OpenAPI spec"
|
||||
python "${SCRIPT_ROOT}/preprocess_spec.py" "${CLIENT_LANGUAGE}" "${KUBERNETES_BRANCH}" "${output_dir}/swagger.json" "${USERNAME}"
|
||||
python "${SCRIPT_ROOT}/preprocess_spec.py" "${CLIENT_LANGUAGE}" "${KUBERNETES_BRANCH}" "${output_dir}/swagger.json" "${USERNAME}" "${REPOSITORY}"
|
||||
|
||||
echo "--- Cleaning up previously generated folders"
|
||||
for i in ${CLEANUP_DIRS}; do
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -302,10 +302,16 @@ def main():
|
||||
help='Optional username if working on forks',
|
||||
default='kubernetes'
|
||||
)
|
||||
argparser.add_argument(
|
||||
'repository',
|
||||
help='Optional repository name if working with kubernetes ecosystem projects',
|
||||
default='kubernetes'
|
||||
)
|
||||
args = argparser.parse_args()
|
||||
|
||||
spec_url = 'https://raw.githubusercontent.com/%s/kubernetes/' \
|
||||
spec_url = 'https://raw.githubusercontent.com/%s/%s/' \
|
||||
'%s/api/openapi-spec/swagger.json' % (args.username,
|
||||
args.repository,
|
||||
args.kubernetes_branch)
|
||||
|
||||
pool = urllib3.PoolManager()
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ if [ $# -ne 2 ]; then
|
||||
echo " $(basename ${0}) OUTPUT_DIR SETTING_FILE_PATH"
|
||||
echo " Setting file should define KUBERNETES_BRANCH, CLIENT_VERSION, and PACKAGE_NAME"
|
||||
echo " Setting file can define an optional USERNAME if you're working on a fork"
|
||||
echo " Setting file can define an optional REPOSITORY if you're working on a ecosystem project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user