Skip to content

Testing can fail in case multiple build jobs are configured #2867

@m-blaha

Description

@m-blaha

What happened? What is the problem?

Lets have multiple build jobs for different targets defined in the .packit.yaml and a test job defined for the later target - for example:

jobs:
  - job: copr_build
    trigger: pull_request
    targets:
      - epel-9
      - epel-10

  - job: copr_build
    trigger: pull_request
    targets:
      - fedora-all

  - job: tests
    trigger: pull_request
    targets:
      - fedora-all

Testing job in this case will fail with error No build defined for the target 'fedora-41-x86_64'. This is because before the testing farm request is sent, packit tests whether build job is configured for the same target. Crucial part of this check is the job_build property of BaseBuildJobHelper:

def job_build(self) -> Optional[JobConfig]:
"""
Check if there is JobConfig for builds defined
:return: JobConfig or None
"""
if not self.job_type_build:
return None
if not self._job_build:
for job in [self.job_config, *self.package_config.jobs]:
if job.type == self.job_type_build and self.is_job_config_trigger_matching(job):
self._job_build = job
break
return self._job_build

which returns the first configured build job regardless its targets (in this case the build job has epel targets, but the tests require fedora).

Workaround is to merge the build jobs into one.

Created based on #2859 issue report.

What did you expect to happen?

Tests are correctly run.

Example URL(s)

No response

Steps to reproduce

What is the impacted category (job)?

Testing Farm tests

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity/single-taskRegular task; should be done within daysgain/lowDoesn't bring much value to usersimpact/lowAffects only few of the userskind/bugAn unexpected problem or behaviorworkaround-existsThere is a workaround that can be used in the meantime

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions