Skip to content

Commit

Permalink
Fix load-image with an image name (#339)
Browse files Browse the repository at this point in the history
- import `IndexSearch` from the right place
- pass missing deadline argument to `should_replace_task`
- fix error message to not refer to mozilla-central
  • Loading branch information
jcristau authored Sep 19, 2023
1 parent 0edc765 commit 24ee3de
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/taskgraph/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_image_digest(image_name):

def load_image_by_name(image_name, tag=None):
from taskgraph.generator import load_tasks_for_kind
from taskgraph.optimize import IndexSearch
from taskgraph.optimize.strategies import IndexSearch
from taskgraph.parameters import Parameters

params = Parameters(
Expand All @@ -43,17 +43,20 @@ def load_image_by_name(image_name, tag=None):
)
tasks = load_tasks_for_kind(params, "docker-image")
task = tasks[f"build-docker-image-{image_name}"]
deadline = None
task_id = IndexSearch().should_replace_task(
task, {}, task.optimization.get("index-search", [])
task, {}, deadline, task.optimization.get("index-search", [])
)

if task_id in (True, False):
print(
"Could not find artifacts for a docker image "
"named `{image_name}`. Local commits and other changes "
"in your checkout may cause this error. Try "
"updating to a fresh checkout of mozilla-central "
"to download image.".format(image_name=image_name)
"updating to a fresh checkout of {project} "
"to download image.".format(
image_name=image_name, project=params["project"]
)
)
return False

Expand Down

0 comments on commit 24ee3de

Please sign in to comment.