Skip to content

Commit 87b1a82

Browse files
authored
chore: populate default_version in .repo-metadata.json (googleapis#10687)
* chore: populate default_version in .repo-metadata.json * remove spaces
1 parent affc8ba commit 87b1a82

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

containers/python-bootstrap-container/.repo-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"repo": "googleapis/google-cloud-python",
1212
"distribution_name": "apiPackage",
1313
"api_id": "apiName.googleapis.com",
14-
"default_version": "",
14+
"default_version": "apiVersion",
1515
"codeowner_team": "",
1616
"api_shortname": "apiName"
1717
}

containers/python-bootstrap-container/entrypoint.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ PATH_TO_CONTAINER_VARS="$WORKSPACE_DIR/interContainerVars.json"
2929

3030
cd "$WORKSPACE_DIR/$MONO_REPO_NAME/containers/python-bootstrap-container"
3131

32+
# API_ID has the form google.cloud.*.vX or `google.*.*.vX`
33+
# Get the version of the API (the value after the last `.`)
34+
# For example, the `API_VERSION` for `google.cloud.workflows.v1`
35+
# will be `v1`
36+
API_VERSION="$(echo $API_ID | sed 's/.*\.//')"
37+
3238
# API_ID has the form google.cloud.*.vX or `google.*.*.vX`
3339
# Replace `.`` with `-` and remove the trailing version
34-
# For example, the `FOLDER_NAME`` for `google.cloud.workflows.v1`
40+
# For example, the `FOLDER_NAME` for `google.cloud.workflows.v1`
3541
# should be `google-cloud-workflows`
3642
FOLDER_NAME="$(echo $API_ID | sed -E 's/\./-/g' | sed 's/-[^-]*$//')"
3743

@@ -81,6 +87,8 @@ DOCS_ROOT_URL=$(jq --arg API_SHORTNAME "$API_SHORTNAME" -r '.apis | to_entries[]
8187
# Update apiProductDocumentation in .repo-metadata.json
8288
sed -i -e "s|apiProductDocumentation|$DOCS_ROOT_URL|" "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}/.repo-metadata.json"
8389

84-
# Update distribution_name in .repo-metadata.json
90+
# Update apiPackage in .repo-metadata.json
8591
sed -i -e "s|apiPackage|$FOLDER_NAME|" "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}/.repo-metadata.json"
8692

93+
# Update apiVersion in .repo-metadata.json
94+
sed -i -e "s|apiVersion|$API_VERSION|" "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}/.repo-metadata.json"

0 commit comments

Comments
 (0)