Skip to content

fix(sles): bootstrap base packages separately - #1217

Closed
djshah19 wants to merge 1 commit into
project-dalec:mainfrom
djshah19:dhwanishah/sles-bootstrap-order
Closed

djshah19 wants to merge 1 commit into
project-dalec:mainfrom
djshah19:dhwanishah/sles-bootstrap-order

Conversation

@djshah19

@djshah19 djshah19 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Install the SLES base userland before the application RPM and its runtime dependency graph. This prevents package scriptlets from invoking a partially installed shell while preserving dependency resolution behavior for other RPM targets.

What this PR does / why we need it:

  • Adds an opt-in separate base-package installation transaction and enables it for SLES 15.
  • Keeps the existing combined transaction for Azure Linux, AlmaLinux, and Rocky Linux so strong application dependencies can override weak base-package recommendations.
  • Squashes minimized output filesystems when separate base-package installation creates an additional layer.
  • Adds focused coverage for combined and separate installation order and conditional layer squashing.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):

None.

Special notes for your reviewer:

The generic split-transaction approach caused the Azure Linux ca-certs_override integration test to fail because a weak prebuilt-ca-certificates recommendation was committed before the application dependency could override it. The split is therefore intentionally scoped to SLES.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煝 Approval recommended

The scoped implementation preserves existing behavior by default and includes focused coverage for both transaction modes.

Pull request overview

Bootstraps the SLES base userland before installing application RPMs to prevent package scriptlet failures.

Changes:

  • Adds configurable separate base-package installation.
  • Enables it for SLES 15.
  • Tests combined and separate installation ordering.
File summaries
File Description
targets/linux/rpm/suse/sles15.go Enables separate bootstrapping for SLES 15.
targets/linux/rpm/distro/distro.go Adds the configuration option.
targets/linux/rpm/distro/container.go Implements ordered installation transactions.
targets/linux/rpm/distro/container_test.go Verifies installation ordering.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread targets/linux/rpm/distro/container.go
@djshah19
djshah19 force-pushed the dhwanishah/sles-bootstrap-order branch 2 times, most recently from bce23f8 to 337d3e4 Compare September 8, 2026 23:31
@djshah19
djshah19 force-pushed the dhwanishah/sles-bootstrap-order branch from 337d3e4 to 566fce8 Compare September 9, 2026 00:21
@cpuguy83

Copy link
Copy Markdown
Collaborator

Can you add an integration test that triggers the case that fails in the old code?

Install the SLES base userland before the application RPM and its runtime dependency graph while preserving the combined transaction for other RPM targets. Keep application repositories out of the bootstrap transaction and retain base RPM metadata for minimization.

Add a BuildKit-backed SLES integration test that reproduces the old combined-transaction failure in the login_defs scriptlet and validates the split installation path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54dc3b04-c791-421f-8328-18f11568031e
Signed-off-by: Dhwani Shah <dhwanishah@microsoft.com>
@djshah19
djshah19 force-pushed the dhwanishah/sles-bootstrap-order branch from 566fce8 to fbd5a18 Compare September 10, 2026 21:27
@djshah19

Copy link
Copy Markdown
Contributor Author

Added in fbd5a18c.

The new SLES integration test uses the Microsoft SLES repository and the same relevant dependency shape as the motivating containerd build (moby-runc, libopenssl3, recommended git/pigz/xz, plus an enabled systemd unit).

I verified the regression in both directions:

  • With the old combined transaction, the test fails while installing login_defs: /bin/sh cannot load libreadline.so.7, and the %prein(login_defs) scriptlet exits 127.
  • With the separate base bootstrap, the base userland is established first and the same test passes, including the application RPM's systemd scriptlet.

The test is under TestSLES15/base_packages_are_installed_before_application_dependencies.

Comment thread test/target_suse_test.go
"coreutils": {},
"grep": {},
"libopenssl3": {},
"moby-runc": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we simplify this to not use moby-runc specifically since that's provided by a different repo.
Just thinking about failure modes here, we are often hit by external infrastructure issues and this introduces extra external infra for this test suite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The moby-runc dependency is intentional because the failure depends on the full zypper dependency graph. I tried smaller SLES-only fixtures, but they also passed with the old combined transaction and therefore did not cover the regression. This is the smallest fixture I found that fails on the old code (login_defs cannot load libreadline.so.7) and passes with the split bootstrap. I agree the additional repository is a failure surface; I can replace it if I find a local fixture that demonstrably fails against the old implementation.

@djshah19
djshah19 requested a review from cpuguy83 September 11, 2026 19:49
@djshah19 djshah19 closed this Sep 14, 2026
@cpuguy83

Copy link
Copy Markdown
Collaborator

The issue this was attempting to fix was caused by a package in packages.microsoft.com's SLES15 repo that includes libgcc_s.so.1 which conflicts with the base repo.
Closed because this is something that can be worked around in the repo config (set a lower priority on the added repo) and would ideally be fixed in the package that caused it.

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.

4 participants