Skip to content

CI Do not auto close tracking issue if tests pass #23155

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

Merged
merged 2 commits into from
Apr 20, 2022
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
3 changes: 2 additions & 1 deletion build_tools/azure/posix-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ jobs:
$CI_NAME \
$ISSUE_REPO \
$LINK_TO_RUN \
--junit-file $JUNIT_FILE
--junit-file $JUNIT_FILE \
--auto-close false
displayName: 'Update issue tracker'
env:
JUNIT_FILE: $(TEST_DIR)/$(JUNITXML)
Expand Down
3 changes: 2 additions & 1 deletion build_tools/azure/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ jobs:
$CI_NAME \
$ISSUE_REPO \
$LINK_TO_RUN \
--junit-file $JUNIT_FILE
--junit-file $JUNIT_FILE \
--auto-close false
displayName: 'Update issue tracker'
env:
JUNIT_FILE: $(TEST_DIR)/$(JUNITXML)
Expand Down
28 changes: 18 additions & 10 deletions maint_tools/update_tracking_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
"exists. If tests-passed is false, then the an issue is updated or created."
),
)
parser.add_argument(
"--auto-close",
help=(
"If --auto-close is false, then issues will not auto close even if the tests"
" pass."
),
default="true",
)

args = parser.parse_args()

Expand Down Expand Up @@ -73,24 +81,24 @@ def create_or_update_issue(body=""):
print(f"Created issue in {args.issue_repo}#{issue.number}")
sys.exit()
else:
# Update existing issue
issue.edit(title=title, body=body_text)
print(f"Updated issue in {args.issue_repo}#{issue.number}")
# Add comment to existing issue
issue.create_comment(body=body_text)
print(f"Commented on issue: {args.issue_repo}#{issue.number}")
sys.exit()


def close_issue_if_opened():
print("Test has no failures!")
issue = get_issue()
if issue is not None:
print(f"Closing issue #{issue.number}")
new_body = (
"## Closed issue because CI is no longer failing! ✅\n\n"
f"[Successful run]({args.link_to_ci_run})\n\n"
"## Previous failure report\n\n"
f"{issue.body}"
comment = (
f"## CI is no longer failing! ✅\n\n[Successful run]({args.link_to_ci_run})"
)
issue.edit(state="closed", body=new_body)
print(f"Commented on issue #{issue.number}")
issue.create_comment(body=comment)
if args.auto_close.lower() == "true":
print(f"Closing issue #{issue.number}")
issue.edit(state="closed")
sys.exit()


Expand Down