Skip to content

Commit

Permalink
Handle missing job numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Apr 27, 2023
1 parent cb1ed72 commit 818b3e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/tinuous/circleci.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def get_build_assets(
raise AssertionError(f"Unhandled EventType: {run_event!r}")
for wf in workflows:
for job in self.get_jobs(wf.id):
if job.job_number is None:
# This can happen if the job was cancelled.
continue
if logs:
for step in self.get_jobv1(job.job_number).steps:
for action in step.actions:
Expand Down Expand Up @@ -437,7 +440,7 @@ class Workflow(BaseModel):
class Job(BaseModel):
# canceled_by: Optional[str] = None
# dependencies: List[str]
job_number: int
job_number: Optional[int] = None
id: str
# started_at: Optional[datetime] = None
name: str
Expand Down
2 changes: 1 addition & 1 deletion src/tinuous/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import re
from string import Formatter
import subprocess
from typing import Any, Optional
from time import time
from typing import Any, Optional

log = logging.getLogger("tinuous")

Expand Down

0 comments on commit 818b3e0

Please sign in to comment.