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

Change build order #873

Merged
merged 1 commit into from
Jul 2, 2024
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
15 changes: 12 additions & 3 deletions alws/build_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ async def init_build_repos(self):
platform.id,
)
for arch in self._request_platforms_arch_list[platform.name]:
if arch == 'src':
continue

tasks.append(self.create_build_repo(platform, arch, 'rpm'))
tasks.append(
self.create_build_repo(
Expand Down Expand Up @@ -447,7 +450,13 @@ async def _add_single_project(
mock_options['definitions'] = {}
dist_taken_by_user = mock_options['definitions'].get('dist', False)
for platform in self._platforms:
for arch in self._request_platforms_arch_list[platform.name]:
arches = self._request_platforms_arch_list[platform.name]
if (
ref.ref_type != BuildTaskRefType.SRPM_URL
and 'src' not in arches
):
arches.insert(0, 'src')
for arch in arches:
modules = self._modules_by_platform_arch.get(
(platform.name, arch), []
)
Expand Down Expand Up @@ -661,8 +670,8 @@ async def build_dependency_map(self):
# between their own tasks to ensure correct build order.
all_tasks = []
for platform_task_cache in self._tasks_cache.values():
first_arch = 'i686'
first_arch_tasks = platform_task_cache.get('i686')
first_arch = 'src'
first_arch_tasks = platform_task_cache.get(first_arch)
if not first_arch_tasks:
first_arch = next(iter(platform_task_cache))
first_arch_tasks = platform_task_cache.get(first_arch)
Expand Down
12 changes: 10 additions & 2 deletions alws/crud/build_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,21 @@ def get_repo(repo_arch, is_debug):
and build_repo.debug == is_debug
)

arch_repo = get_repo(task_arch, False)
debug_repo = get_repo(task_arch, True)
arch_repo = None
debug_repo = None
if task_arch != 'src':
arch_repo = get_repo(task_arch, False)
debug_repo = get_repo(task_arch, True)
src_repo = get_repo("src", False)
arch_packages_tasks = []
src_packages_tasks = []
debug_packages_tasks = []
for artifact in task_artifacts:
if task_arch == 'src':
if artifact.arch == "src":
src_packages_tasks.append(pulp_client.create_entity(artifact))
break
continue
if artifact.arch == "src":
if built_srpm_url is None:
src_packages_tasks.append(pulp_client.create_entity(artifact))
Expand Down
1 change: 1 addition & 0 deletions alws/crud/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ async def create_test_tasks_for_build_id(db: AsyncSession, build_id: int):
select(models.BuildTask.id).where(
models.BuildTask.build_id == build_id,
models.BuildTask.status == BuildTaskStatus.COMPLETED,
models.BuildTask.arch != 'src',
)
)
)
Expand Down
12 changes: 9 additions & 3 deletions alws/routers/build_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,18 @@ async def get_task(
"email": task.build.owner.email,
},
}
supported_arches = request.supported_arches
if 'src' in request.supported_arches:
supported_arches.remove('src')
task_arch = task.arch
if task_arch == 'src':
task_arch = supported_arches[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if src will not be the first arch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need src as the first arch in supported_arches that's why I removed it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but what will happen when you finishing src task? It looks like this way you'll be treating src task like e.g. aarch64 task which is not fully correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that is exactly what I am trying to do here. This part of the code adds repositories for a builder to build RPM. So because we can build src on any builders we need to add here only repositories for builder supported arch.

for repo in itertools.chain(task.platform.repos, task.build.repos):
if repo.arch == task.arch and repo.type != "build_log":
if repo.arch == task_arch and repo.type != "build_log":
response["repositories"].append(repo)
for build in task.build.linked_builds:
for repo in build.repos:
if repo.arch == task.arch and repo.type != "build_log":
if repo.arch == task_arch and repo.type != "build_log":
response["repositories"].append(repo)
if task.build.platform_flavors:
for flavour in task.build.platform_flavors:
Expand All @@ -120,7 +126,7 @@ async def get_task(
flavour.data["definitions"]
)
for repo in flavour.repos:
if repo.arch == task.arch:
if repo.arch == task_arch:
response["repositories"].append(repo)

# TODO: Get rid of this fixes when all affected builds would be processed
Expand Down