Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 8c32e97

Browse files
authored
test: retrieve unique package and latest version for YAML generation (#190)
* test: fix unique tarball retrieval to latest version * test: retrieve package name by parsing the entries
1 parent 68626ad commit 8c32e97

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.kokoro/generate-docs.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,23 @@ python3 -m pip install recommonmark
3636
# Required for some client libraries:
3737
python3 -m pip install --user django==2.2 ipython
3838

39+
# Store the contents of bucket log in a variable to reuse.
40+
python_bucket_items=$(gsutil ls "gs://docs-staging-v2/docfx-python*")
3941
# Retrieve unique repositories to regenerate the YAML with.
40-
for bucket_item in $(gsutil ls 'gs://docs-staging-v2/docfx-python*' | sort -u -t- -k5,5); do
42+
for package in $(echo "${python_bucket_items}" | cut -d "-" -f 5- | rev | cut -d "-" -f 2- | rev | uniq); do
4143

42-
# Retrieve the GitHub Repository info.
44+
# Extract the latest version of the package to grab latest metadata.
45+
version=$(echo "${python_bucket_items}" | grep "docfx-python-${package}-" | rev | cut -d "-" -f 1 | rev | sort -V -r | head -1)
46+
47+
# Set the bucket and tarball values to be used for the package.
48+
bucket_item=$(echo "gs://docs-staging-v2/docfx-python-${package}-${version}")
4349
tarball=$(echo ${bucket_item} | cut -d "/" -f 4)
4450

4551
# Make temporary directory to extract tarball content.
4652
mkdir ${tarball}
4753
cd ${tarball}
4854

55+
# Retrieve the GitHub Repository info.
4956
gsutil cp ${bucket_item} .
5057
tar -zxvf ${tarball}
5158
repo=$(cat docs.metadata | grep "github_repository:" | cut -d "\"" -f 2 | cut -d "/" -f 2)

0 commit comments

Comments
 (0)