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

Cancel bitrise tasks on taskcluster cancellation #1105

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Don't retrieve logs if a job gets cancelled
Note that while it would look better to have an early return in the
`finally`, we can't do that as returning from `finally` eats the
exception and it doesn't get raised to the parent (which in this case
would be in charge of actually cancelling the build).

Skipping the log retrieval here is necessary because it would just wait
for the build to finish again, defeating the point of cancelling the
job.
Eijebong committed Dec 18, 2024
commit 181285677ad62db3a0806834962f15360e8cf97d
11 changes: 8 additions & 3 deletions bitrisescript/src/bitrisescript/bitrise.py
Original file line number Diff line number Diff line change
@@ -236,14 +236,19 @@ async def wait_and_download_workflow_log(artifacts_dir: str, build_slug: str) ->
artifacts_dir (str): Directory to download artifacts to.
build_slug (str): Identifier of workflow to run.
"""
skip_log_retrieval = False
Eijebong marked this conversation as resolved.
Show resolved Hide resolved
try:
await wait_for_build_finish(build_slug)
log.info(f"Build '{build_slug}' is successful. Retrieving artifacts...")
await download_artifacts(build_slug, artifacts_dir)
except asyncio.CancelledError:
skip_log_retrieval = True
raise
finally:
log.info(f"Retrieving bitrise log for '{build_slug}'...")
await download_log(build_slug, artifacts_dir)
await dump_perfherder_data(artifacts_dir)
if not skip_log_retrieval:
log.info(f"Retrieving bitrise log for '{build_slug}'...")
await download_log(build_slug, artifacts_dir)
await dump_perfherder_data(artifacts_dir)


async def run_build(artifacts_dir: str, workflow_id: str, **build_params: Any) -> None: