Skip to content

Commit cccac8c

Browse files
authored
chore: set up the kokoro release pipeline (#14)
1 parent bf6ecb8 commit cccac8c

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

.kokoro/release.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# Copyright 2023 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Start the releasetool reporter
19+
python3 -m pip install --require-hashes -r github/python-bigquery-dataframes/.kokoro/requirements.txt
20+
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
21+
22+
# Disable buffering, so that the logs stream through.
23+
export PYTHONUNBUFFERED=1
24+
25+
# Move into the package, build the distribution and upload.
26+
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1")
27+
cd github/python-bigquery-dataframes
28+
python3 setup.py sdist bdist_wheel
29+
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*

.kokoro/release/common.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Download trampoline resources.
11+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12+
13+
# Use the trampoline script to run in docker.
14+
build_file: "python-bigquery-dataframes/.kokoro/trampoline_v2.sh"
15+
16+
# Configure the docker image for kokoro-trampoline.
17+
env_vars: {
18+
key: "TRAMPOLINE_IMAGE"
19+
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
20+
}
21+
env_vars: {
22+
key: "TRAMPOLINE_BUILD_FILE"
23+
value: "github/python-bigquery-dataframes/.kokoro/release.sh"
24+
}
25+
26+
# Fetch PyPI password
27+
before_action {
28+
fetch_keystore {
29+
keystore_resource {
30+
keystore_config_id: 73713
31+
keyname: "google-cloud-pypi-token-keystore-1"
32+
}
33+
}
34+
}
35+
36+
# Tokens needed to report release status back to GitHub
37+
env_vars: {
38+
key: "SECRET_MANAGER_KEYS"
39+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
40+
}
41+
42+
# Store the packages we uploaded to PyPI. That way, we have a record of exactly
43+
# what we published, which we can use to generate SBOMs and attestations.
44+
action {
45+
define_artifacts {
46+
regex: "github/python-bigquery-dataframes/**/*.tar.gz"
47+
strip_prefix: "github/python-bigquery-dataframes"
48+
}
49+
}

.kokoro/release/release.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto

0 commit comments

Comments
 (0)