Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.3.0] Fix relnotes script #18491

Merged
merged 1 commit into from
May 24, 2023
Merged
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
20 changes: 12 additions & 8 deletions scripts/release/relnotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""Script to generate release notes."""

import os
import re
import subprocess
import sys
Expand Down Expand Up @@ -87,13 +86,13 @@ def get_relnotes_between(base, head, is_major_release):

def get_label(issue_id):
"""Get team-X label added to issue."""
auth = os.system(
auth = subprocess.check_output(
"gsutil cat"
" gs://bazel-trusted-encrypted-secrets/github-trusted-token.enc |"
" gcloud kms decrypt --project bazel-public --location global"
" --keyring buildkite --key github-trusted-token --ciphertext-file"
" - --plaintext-file -"
)
" - --plaintext-file -", shell=True
).decode("utf-8").strip().split("\n")[0]
headers = {
"Authorization": "Bearer " + auth,
"Accept": "application/vnd.github+json",
Expand Down Expand Up @@ -159,11 +158,16 @@ def get_external_authors_between(base, head):
# e.g. if current_release is 5.3.3, last_release should be 5.3.2 even if
# latest release is 6.1.1
current_release = git("rev-parse", "--abbrev-ref", "HEAD")[0]
if not current_release.startswith("release-"):
print("Error: Not a release- branch")
sys.exit(1)

current_release = re.sub(r"rc\d", "", current_release[len("release-"):])
if current_release.startswith("release-"):
current_release = re.sub(r"rc\d", "", current_release[len("release-"):])
else:
try:
current_release = git("describe", "--tags")[0]
except Exception: # pylint: disable=broad-exception-caught
print("Error: Not a release branch.")
sys.exit(1)

is_major = bool(re.fullmatch(r"\d+.0.0", current_release))

tags = [tag for tag in git("tag", "--sort=refname") if "pre" not in tag]
Expand Down