Allow specifying a github repository if working on ecosystem projects (#63)

This commit is contained in:
Tamal Saha
2018-06-25 07:30:35 -07:00
committed by Brendan Burns
parent 55f9ae0366
commit 7d7ec1cfee
11 changed files with 20 additions and 4 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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