-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(main): Added kokoro release job (#7788)
- Loading branch information
1 parent
3678dde
commit e50c53c
Showing
4 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
enabled: true | ||
multiScmName: google-cloud-go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
|
||
# Fail on any error. | ||
set -eo pipefail | ||
|
||
# Install jq | ||
apt install jq zip -y | ||
|
||
# Start the releasetool reporter | ||
requirementsFile=$(realpath $(dirname "$0"))/requirements.txt | ||
python3 -m pip install --require-hashes -r $requirementsFile | ||
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script | ||
|
||
cd github/google-cloud-go/ | ||
|
||
# Create a directory for storing all the artifacts | ||
mkdir pkg | ||
|
||
# Test prechecks | ||
if [ -z "${AUTORELEASE_PR}" ] | ||
then | ||
echo "Need to provide URL to release PR via AUTORELEASE_PR environment variable" | ||
exit 1 | ||
fi | ||
|
||
# Extract the PR number from the AUTORELEASE_PR variable | ||
get_pr_number () { | ||
echo "$(basename "$1")" | ||
} | ||
|
||
# Get the PR number | ||
pr_number=$(get_pr_number $AUTORELEASE_PR) | ||
|
||
# Returns the list of modules released in the PR. | ||
release_modules () { | ||
echo $(curl -s https://api.github.com/repos/googleapis/google-cloud-go/pulls/$1/files | \ | ||
jq -r 'map(select(.filename == ".release-please-manifest-individual.json" or .filename == ".release-please-manifest-submodules.json") | .patch)[0]' | \ | ||
awk -v RS='\n' '/^[+]/{print substr($2,2, length($2)-3)}') | ||
} | ||
|
||
# Create a zip file for each released module and store it in the pkg/ | ||
# directory to be used as an artifact | ||
release_modules $pr_number | while read -r module | ||
do | ||
zip -rq "pkg/$module.zip" "$module" >/dev/null | ||
done | ||
|
||
# Store the commit hash in a txt as an artifact. | ||
echo -e $KOKORO_GITHUB_COMMIT >> pkg/commit.txt | ||
|
||
# Test! | ||
sample_pr_1="https://github.com/googleapis/google-cloud-go/pull/7687" | ||
sample_pr_2="https://github.com/googleapis/google-cloud-go/pull/7701" | ||
|
||
pr_number_1=$(get_pr_number $sample_pr_1) | ||
pr_number_2=$(get_pr_number $sample_pr_2) | ||
|
||
if [ "$pr_number_1" != "7687" ] ; then | ||
echo "Error: Incorrect value from get_pr_number." | ||
exit | ||
fi | ||
|
||
if [ "$(release_modules $pr_number_1)" != "aiplatform appengine compute contactcenterinsights container iap retail security workstations" ] ; then | ||
echo "Error: Incorrect value from release_modules." | ||
exit | ||
fi | ||
|
||
if [ "$(release_modules $pr_number_2)" != "bigquery" ] ; then | ||
echo "Error: Incorrect value from release_modules." | ||
exit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
attrs==22.1.0 | ||
cachetools==4.2.4 | ||
certifi==2022.12.7 | ||
cffi==1.15.1 | ||
charset-normalizer==2.0.12 | ||
click==8.0.4 | ||
colorlog==6.7.0 | ||
cryptography==39.0.1 | ||
gcp-docuploader==0.6.3 | ||
gcp-releasetool==1.10.5 | ||
google-api-core==2.8.2 | ||
google-auth==2.14.1 | ||
google-cloud-core==2.3.1 | ||
google-cloud-storage==2.0.0 | ||
google-crc32c==1.3.0 | ||
google-resumable-media==2.5.0 | ||
googleapis-common-protos==1.56.3 | ||
idna==3.4 | ||
importlib-metadata==4.8.3 | ||
jeepney==0.7.1 | ||
Jinja2==3.0.3 | ||
keyring==23.4.1 | ||
MarkupSafe==2.0.1 | ||
packaging==21.3 | ||
protobuf==3.19.5 | ||
pyasn1==0.5.0 | ||
pyasn1-modules==0.3.0 | ||
pycparser==2.21 | ||
PyJWT==2.4.0 | ||
pyparsing==3.0.9 | ||
pyperclip==1.8.2 | ||
python-dateutil==2.8.2 | ||
requests==2.27.1 | ||
rsa==4.9 | ||
SecretStorage==3.3.3 | ||
six==1.16.0 | ||
typing_extensions==4.1.1 | ||
urllib3==1.26.12 | ||
zipp==3.6.0 |
Oops, something went wrong.