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

Add more debug lines to downstreaming changelog #2309

Merged
Merged
Show file tree
Hide file tree
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
24 changes: 14 additions & 10 deletions .ci/magic-modules/downstream_changelog_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
unset.
"""
from pyutils import strutils, downstreams
from github import Github
import github
import os
import sys
import argparse
Expand Down Expand Up @@ -46,20 +46,18 @@ def downstream_changelog_info(gh, upstream_pr_num, changelog_repos):
print "Labels: %s" % labels_to_add

parsed_urls = downstreams.get_parsed_downstream_urls(gh, upstream_pr.number)
if not parsed_urls:
print "No downstreams found for upstream PR %d, returning!" % (
upstream_pr.number)
return
found = False

for repo_name, pulls in parsed_urls:
found = True
print "Found downstream PR for repo %s" % repo_name

if repo_name not in changelog_repos:
print "[DEBUG] skipping repo %s with no CHANGELOG" % repo_name
continue

print "Generating changelog for pull requests in %s" % repo_name

print "Fetching repo %s" % repo_name
ghrepo = gh.get_repo(repo_name)

Expand All @@ -68,6 +66,9 @@ def downstream_changelog_info(gh, upstream_pr_num, changelog_repos):
pr = ghrepo.get_pull(int(prnum))
set_changelog_info(pr, release_note, labels_to_add)

if not found:
print "No downstreams found for upstream PR %d, returning!" % upstream_pr.number

def set_changelog_info(gh_pull, release_note, labels_to_add):
"""Set release note and labels on a downstream PR in Github.

Expand Down Expand Up @@ -95,9 +96,12 @@ def set_changelog_info(gh_pull, release_note, labels_to_add):
print "Skipping, no downstreams repos given to downstream changelog info for"
sys.exit(0)

gh = Github(os.environ.get('GITHUB_TOKEN'))

gh = github.Github(os.environ.get('GITHUB_TOKEN'))
assert len(sys.argv) == 2, "expected id filename as argument"
with open(sys.argv[1]) as f:
pr_num = int(f.read())
downstream_changelog_info(gh, pr_num, downstream_repos)
try:
downstream_changelog_info(gh, pr_num, downstream_repos)
except e:
print "got error %s" % e
raise e
4 changes: 2 additions & 2 deletions .ci/magic-modules/pyutils/downstreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def get_downstream_urls(client, pr_num):
List of downstream PR URLs.
"""
urls = []
print "Getting downstream URLs for PR %d..." % pr_num
pr = client.get_repo(UPSTREAM_REPO).get_pull(pr_num)
for comment in pr.get_issue_comments():
urls = urls + find_dependency_urls_in_comment(comment.body)
print "Found downstream URLs: %s" % urls
return urls