Skip to content

Commit 611247e

Browse files
author
Emerson Knapp
committed
Fix ros_ci parameters
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
1 parent 7267261 commit 611247e

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

ros_github_scripts/ci_for_pr.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
DEFAULT_JOB = 'ci_launcher'
2929
REPOS_URL = 'https://raw.githubusercontent.com/ros2/ros2/{}/ros2.repos'
30-
DEFAULT_TARGET = 'master'
30+
DEFAULT_TARGET = 'rolling'
3131
CI_SERVER = 'https://ci.ros2.org'
3232
SERVER_RETRIES = 2
3333

@@ -38,7 +38,10 @@ def panic(msg: str) -> None:
3838

3939
def fetch_repos(target_release: str) -> dict:
4040
"""Fetch the repos file for the specific release."""
41-
repos_response = requests.get(REPOS_URL.format(target_release))
41+
branch = target_release
42+
if branch == 'rolling':
43+
branch = 'master'
44+
repos_response = requests.get(REPOS_URL.format(branch))
4245

4346
repos_text = repos_response.text
4447
toplevel_dict = yaml.safe_load(repos_text)
@@ -53,11 +56,14 @@ def create_ci_gist(
5356
"""Create gist for the list of pull requests."""
5457
logger.info('Creating ros2.repos Gist for PRs')
5558
master_repos = fetch_repos(target_release)
59+
shortnames = []
5660
for github_pr in pulls:
5761
pr_ref = github_pr.head.ref
5862
pr_repo = github_pr.head.repo.full_name
5963
base_repo = github_pr.base.repo.full_name
6064

65+
shortnames.append(f'{base_repo}#{github_pr.number}')
66+
6167
# Remove the existing repository from the list
6268
repo_entry = master_repos.pop(base_repo, None)
6369
if repo_entry:
@@ -81,7 +87,7 @@ def create_ci_gist(
8187
gist = github_instance.get_user().create_gist(
8288
public=True,
8389
files={'ros2.repos': input_file},
84-
description='CI input for PR {}'.format(github_pr.url))
90+
description='CI input for PR {}'.format(' '.join(shortnames)))
8591
return gist
8692

8793

@@ -175,11 +181,14 @@ def validate_and_fetch_pull_list(
175181
return return_prs
176182

177183

178-
def format_ci_details(gist_url: str, extra_build_args: str, extra_test_args: str) -> str:
184+
def format_ci_details(
185+
gist_url: str, extra_build_args: str, extra_test_args: str, target_release: str,
186+
) -> str:
179187
return '\n'.join([
180188
f'Gist: {gist_url}',
181189
f'BUILD args: {extra_build_args}',
182190
f'TEST args: {extra_test_args}',
191+
f'ROS Distro: {target_release}',
183192
'Job: {}'.format(DEFAULT_JOB),
184193
])
185194

@@ -327,7 +336,8 @@ def main():
327336
extra_test_args = f'--packages-select {packages_changed}'
328337

329338
comment_texts = []
330-
comment_texts.append(format_ci_details(gist_url, extra_build_args, extra_test_args))
339+
comment_texts.append(
340+
format_ci_details(gist_url, extra_build_args, extra_test_args, parsed.target))
331341
if parsed.build:
332342
user = github_instance.get_user().login
333343
comment_texts.append(

0 commit comments

Comments
 (0)