Skip to content

Commit

Permalink
[orion-builder/decision] Fix combine.py artifact and test
Browse files Browse the repository at this point in the history
  • Loading branch information
asuleimanov committed Oct 15, 2024
1 parent d23f85c commit 8c1cd52
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
6 changes: 3 additions & 3 deletions services/orion-builder/src/orion_builder/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def main(argv: Optional[List[str]] = None) -> None:
service_name = args.service_name

if isinstance(args.archs, list): # TODO: remove
LOG.info(f"YAML array worked: {args.archs}")
print(f"YAML array worked: {args.archs}")
archs = args.archs
else:
LOG.info(f"YAML array failed, converting from string: {args.archs}")
print(f"YAML array failed, converting from string: {args.archs}")
archs = args.archs.strip("[]").replace("'", "").split(", ")

config = Configuration(argparse.Namespace(secret=None, config=None))
Expand Down Expand Up @@ -138,7 +138,7 @@ def main(argv: Optional[List[str]] = None) -> None:
f"{args.registry}/mozillasecurity/{service_name}:latest-{arch}"
for arch in archs
]
+ ["--output", f"{args.write}.tar"]
+ ["--output", f"{args.write}"]
)
print(f"Save multiarch image result: {save_result}")
zstd_compress(args.write)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ payload:
GIT_REVISION: "${commit}"
IMAGE_NAME: "mozillasecurity/${service_name}"
SERVICE_NAME: "${service_name}"
ARCHS: "${archs}" #TODO: check if all archs were passed from scheduler.py
ARCHS: "${archs}"
capabilities:
privileged: true
# TODO: change back to mozillasecurity once approved
Expand Down
2 changes: 2 additions & 0 deletions services/orion-decision/tests/fixtures/services12/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hadolint ignore=DL3061
RUN ./script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "this script only prints this message"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: test1
arch:
- amd64
- arm64
16 changes: 7 additions & 9 deletions services/orion-decision/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def test_create_14(mocker: MockerFixture) -> None:
taskcluster = mocker.patch("orion_decision.scheduler.Taskcluster", autospec=True)
queue = taskcluster.get_service.return_value
now = datetime.now(timezone.utc)
root = FIXTURES / "services03"
root = FIXTURES / "services12"
evt = mocker.Mock(spec=GithubEvent())
evt.repo.path = root
evt.repo.git = mocker.Mock(
Expand All @@ -775,10 +775,8 @@ def test_create_14(mocker: MockerFixture) -> None:
evt.branch = "main"
evt.http_url = "https://example.com"
evt.pull_request = None
sched = Scheduler(evt, "group", "scheduler", "secret", "push") # TODO: push?
sched.services["test1"].dirty = True # TODO: how to differentiate?
sched.services["test2"].dirty = True # since IRL service name will
sched.services["test3"].dirty = True # be same for build tasks 1 and 2)
sched = Scheduler(evt, "group", "scheduler", "secret", "push")
sched.services["test1"].dirty = True
sched.create_tasks()
assert queue.createTask.call_count == 3
task1_id, task1 = queue.createTask.call_args_list[0][0]
Expand All @@ -787,7 +785,7 @@ def test_create_14(mocker: MockerFixture) -> None:
clone_url="https://example.com",
commit="commit",
deadline=stringDate(now + DEADLINE),
dockerfile="test1/Dockerfile",
dockerfile="Dockerfile",
expires=stringDate(now + ARTIFACTS_EXPIRE),
load_deps="0",
max_run_time=int(MAX_RUN_TIME.total_seconds()),
Expand All @@ -808,15 +806,15 @@ def test_create_14(mocker: MockerFixture) -> None:
clone_url="https://example.com",
commit="commit",
deadline=stringDate(now + DEADLINE),
dockerfile="test2/Dockerfile",
dockerfile="Dockerfile",
expires=stringDate(now + ARTIFACTS_EXPIRE),
load_deps="0",
max_run_time=int(MAX_RUN_TIME.total_seconds()),
now=stringDate(now),
owner_email=OWNER_EMAIL,
provisioner=PROVISIONER_ID,
scheduler="scheduler",
service_name="test2",
service_name="test1",
source_url=SOURCE_URL,
task_group="group",
worker=WORKER_TYPE_ARM64,
Expand All @@ -835,7 +833,7 @@ def test_create_14(mocker: MockerFixture) -> None:
owner_email=OWNER_EMAIL,
provisioner=PROVISIONER_ID,
scheduler="scheduler",
service_name="test3",
service_name="test1",
source_url=SOURCE_URL,
task_group="group",
worker=WORKER_TYPE,
Expand Down

0 comments on commit 8c1cd52

Please sign in to comment.