Skip to content

fix(ubuntu): pass AllowPackages from template to debutils.Repository#480

Merged
arodage merged 2 commits intomainfrom
fix/ubuntu-allowpackages-passthrough
Mar 12, 2026
Merged

fix(ubuntu): pass AllowPackages from template to debutils.Repository#480
arodage merged 2 commits intomainfrom
fix/ubuntu-allowpackages-passthrough

Conversation

@arodage
Copy link
Copy Markdown
Contributor

@arodage arodage commented Mar 11, 2026

Merge Checklist

  • The changes in the PR have been built and tested
  • Documentation has been updated to reflect the changes (or no doc update needed)
  • Ready to merge

Description

The Ubuntu provider manually maps config.PackageRepository fields into debutils.Repository when building user repository configurations in downloadImagePkgs(). The AllowPackages field was not included in this mapping, causing the allowPackages filter from image templates to be silently ignored.

This meant all packages from user-defined repositories were indexed regardless of any allowPackages restrictions.

Root cause: Ubuntu's provider builds its own debutils.Repository list instead of using the shared debutils.UserPackages() path that ELXR uses. The manual field mapping simply omitted AllowPackages.

Fix: Add AllowPackages: userRepo.AllowPackages to the debutils.Repository{} struct literal.

Other providers are not affected:

  • ELXR (DEB): uses debutils.UserRepodebutils.UserPackages() which already maps AllowPackages
  • EMT, AZL, RCD (RPM): pass config.PackageRepository directly to rpmutils.UserRepo which reads AllowPackages from the struct

Any Newly Introduced Dependencies

None.

How Has This Been Tested?

  • Built and verified an image build with ubuntu24-x86_64-robotics-jazzy-raw.yml template using allowPackages on ECI (priority 1000) and AMR (priority 1001) repositories — 2339 packages resolved, 2319 installed, image built successfully (6.97 GB compressed)
  • Without this fix, the same template with allowPackages has no effect and all ECI packages are indexed, causing duplicate versions in cache

@arodage arodage requested a review from a team as a code owner March 11, 2026 21:12
Copilot AI review requested due to automatic review settings March 11, 2026 21:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Ubuntu provider behavior so packageRepositories[].allowPackages from image templates is respected when converting user repos into debutils.Repository, preventing unintended indexing of all packages from user-defined repositories.

Changes:

  • Pass AllowPackages from config.PackageRepository into the Ubuntu provider’s debutils.Repository mapping.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread internal/provider/ubuntu/ubuntu.go Outdated
Comment thread internal/provider/ubuntu/ubuntu.go Outdated
arodage added a commit that referenced this pull request Mar 11, 2026
Extract buildUserRepoList() helper from downloadImagePkgs() to make
the user repo mapping testable in isolation.

New tests:
- TestBuildUserRepoListAllowPackages: table-driven test verifying
  AllowPackages is forwarded, nil is preserved, placeholders skipped,
  and multiple repos each keep their own filter
- TestBuildUserRepoListFieldMapping: verifies all PackageRepository
  fields (Codename, URL, PKey, Component, Priority, AllowPackages, ID)
  are correctly mapped to debutils.Repository

Addresses Copilot review comment on PR #480.
arodage added 2 commits March 11, 2026 23:44
The Ubuntu provider manually maps config.PackageRepository fields into
debutils.Repository when building user repository configurations. The
AllowPackages field was not included in this mapping, causing the
allowPackages filter from image templates to be silently ignored

Signed-off-by: Rodage, Alpesh Ramesh <alpesh.ramesh.rodage@intel.com>
Extract buildUserRepoList() helper from downloadImagePkgs() to make
the user repo mapping testable in isolation.

New tests:
- TestBuildUserRepoListAllowPackages: table-driven test verifying
  AllowPackages is forwarded, nil is preserved, placeholders skipped,
  and multiple repos each keep their own filter
- TestBuildUserRepoListFieldMapping: verifies all PackageRepository
  fields (Codename, URL, PKey, Component, Priority, AllowPackages, ID)
  are correctly mapped to debutils.Repository

Addresses Copilot review comment on PR #480.

Signed-off-by: Rodage, Alpesh Ramesh <alpesh.ramesh.rodage@intel.com>
@arodage arodage force-pushed the fix/ubuntu-allowpackages-passthrough branch from 3b56384 to 310d664 Compare March 12, 2026 03:54
@arodage arodage merged commit 0f60890 into main Mar 12, 2026
34 of 35 checks passed
@arodage arodage deleted the fix/ubuntu-allowpackages-passthrough branch March 12, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants