Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions scripts/download-oas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ if [[ -z ${OAS_API_VERSIONS} ]]; then
OAS_API_VERSIONS="${ROOT_DIR}/api-versions-lock.json"
fi

if [ -d "${ROOT_DIR}/oas" ]; then
echo "OAS folder found. Will be removed"
rm -rf "${ROOT_DIR}/oas"
fi

git clone "${OAS_REPO}" "${ROOT_DIR}/oas" --quiet
# OPTIONAL: Lock to a specific commit
# cd "${ROOT_DIR}/oas"
# git checkout <HASH>

# NOTE: Everything below is needed for the "compatibility layer" logic.
# It can be completely removed once the compatibility layer isn't needed anymore in the SDK.

# Create temp directory to clone OAS repo
work_dir=$(mktemp -d)
if [[ ! ${work_dir} || -d {work_dir} ]]; then
Expand All @@ -31,13 +44,7 @@ if [[ ! ${work_dir} || -d {work_dir} ]]; then
fi
trap "rm -rf ${work_dir}" EXIT # Delete temp directory on exit

if [ -d "${ROOT_DIR}/oas" ]; then
echo "OAS folder found. Will be removed"
rm -r "${ROOT_DIR}/oas"
fi

# Move oas to root level
mkdir "${ROOT_DIR}/oas"
mkdir "${ROOT_DIR}/oas/legacy"
cd "${work_dir}"
git clone "${OAS_REPO}" --quiet

Expand Down Expand Up @@ -67,11 +74,6 @@ EOF
service_normalized=$(echo "${service_normalized}" | tr '[:upper:]' '[:lower:]') # convert upper case letters to lower case
service_normalized=$(echo "${service_normalized}" | tr -d -c '[:alnum:]') # remove non-alphanumeric characters
echo "$service_normalized=$(git rev-parse HEAD)" >> oas_commits
# To support initial integrations of the IaaS API in an Alpha state, we will temporarily use it to generate an IaaS Alpha SDK module
# This check can be removed once the IaaS API moves all endpoints to Beta
if [[ ${service_normalized} == "iaas" ]]; then
echo "iaasalpha=$(git rev-parse HEAD)" >> oas_commits
fi

cd - >/dev/null

Expand All @@ -88,12 +90,6 @@ EOF
version=${version#v}
# Check if version is alpha
if [[ ${version} == *alpha* ]]; then
# To support initial integrations of the IaaS API in an Alpha state, we will temporarily use it to generate an IaaS Alpha SDK module
# This check can be removed once the IaaS API moves all endpoints to Beta
if [[ ${service} == "iaas" ]]; then
mv -f ${dir}/*.json ${ROOT_DIR}/oas/iaasalpha.json
continue
fi
if [[ ${ALLOW_ALPHA} != "true" ]]; then
continue
fi
Expand Down Expand Up @@ -135,6 +131,6 @@ EOF
echo "No elegible OAS found for ${service_dir}"
continue
fi
mv -f ${max_version_dir}/*.json ${ROOT_DIR}/oas
mv -f ${max_version_dir}/*.json ${ROOT_DIR}/oas/legacy
done
mv -f ${work_dir}/${OAS_REPO_NAME}/oas_commits ${ROOT_DIR}/oas/oas_commits
mv -f ${work_dir}/${OAS_REPO_NAME}/oas_commits ${ROOT_DIR}/oas/legacy/oas_commits
2 changes: 1 addition & 1 deletion scripts/generate-sdk/languages/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ generate_go_sdk() {
warning=""

# Generate SDK for each service
for service_json in ${ROOT_DIR}/oas/*.json; do
for service_json in ${ROOT_DIR}/oas/legacy/*.json; do
service="${service_json##*/}"
service="${service%.json}"

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-sdk/languages/java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ generate_java_sdk() {
warning=""

# Generate SDK for each service
for service_json in "${ROOT_DIR}"/oas/*.json; do
for service_json in "${ROOT_DIR}"/oas/legacy/*.json; do
service="${service_json##*/}"
service="${service%.json}"

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-sdk/languages/python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ generate_python_sdk() {
warning=""

# Generate SDK for each service
for service_json in ${ROOT_DIR}/oas/*.json; do
for service_json in ${ROOT_DIR}/oas/legacy/*.json; do
service="${service_json##*/}"
service="${service%.json}"

Expand Down
4 changes: 2 additions & 2 deletions scripts/sdk-create-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
echo "old commit: ${old_commit}"
fi
new_commit=""
if [[ -f "${ROOT_DIR}/oas/oas_commits" ]]; then
new_commit=$(grep "${service}=" "${ROOT_DIR}/oas/oas_commits" | cut -d = -f 2)
if [[ -f "${ROOT_DIR}/oas/legacy/oas_commits" ]]; then
new_commit=$(grep "${service}=" "${ROOT_DIR}/oas/legacy/oas_commits" | cut -d = -f 2)
echo "new commit: ${new_commit}"
fi
compare_link=""
Expand Down
Loading