Skip to content

Harden Linux SDK dependency setup - #770

Merged
Richie Gomez (richiemsft) merged 3 commits into
mainfrom
harden-linux-sdk-dependencies
Aug 7, 2026
Merged

Harden Linux SDK dependency setup#770
Richie Gomez (richiemsft) merged 3 commits into
mainfrom
harden-linux-sdk-dependencies

Conversation

@richiemsft

@richiemsft Richie Gomez (richiemsft) commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📖 Description

Keep the cached Bubblewrap/LXC installation as the fast path while preventing stale Ubuntu package metadata from producing a green setup step with no packages installed.

  • Refresh apt indexes before the cache action resolves package versions.
  • Bump the cache namespace to avoid reusing the empty cache saved by the failed run.
  • Verify all requested packages plus bwrap and lxc-start after restoration.
  • Retry a direct apt installation up to three times when the cached action is incomplete.
  • Fail immediately when LXC profiles or services cannot be activated.

🔗 References

Observed in https://github.com/microsoft/mxc/actions/runs/31195213220/job/92925641972

🔍 Validation

  • Parsed SDK.Integration.Test.Job.yml as YAML.
  • Checked the repair script with bash -n.
  • Ran git diff --check.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Refresh apt metadata before the cached installation, verify Bubblewrap and LXC afterward, and retry a direct install when the cache action leaves dependencies incomplete.

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

Copilot-Session: 52e48fee-23e1-4b05-803c-522812fcdda2
@richiemsft
Richie Gomez (richiemsft) requested review from a team and a balanced review from Copilot August 7, 2026 16:39
@richiemsft
Richie Gomez (richiemsft) requested a review from a team as a code owner August 7, 2026 16:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@richiemsft

Copy link
Copy Markdown
Contributor Author

hey Soham Das (@SohamDas2021) I've been getting some flaky results from the linux validation step, sometimes there is a 404 in the logs. adding retries to the job.

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.

Pull request overview

Hardens Linux SDK integration dependency setup against stale APT metadata and incomplete cache restoration.

Changes:

  • Refreshes APT indexes and bumps the cache namespace.
  • Adds dependency verification, repair retries, and strict LXC service checks.
  • One issue remains: dpkg-query forces repair on every cache hit.

Comment thread .github/workflows/SDK.Integration.Test.Job.yml Outdated
Validate the commands restored by cache-apt-pkgs-action instead of querying dpkg state, which the action intentionally does not restore.

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

Copilot-Session: 52e48fee-23e1-4b05-803c-522812fcdda2
Copilot AI review requested due to automatic review settings August 7, 2026 16:47

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

.github/workflows/SDK.Integration.Test.Job.yml:142

  • The retry loop does not cover index-refresh failures: because set -e is active and apt-get update is outside the if, any transient update error exits the step on the first attempt instead of reaching attempts 2 and 3. Include the refresh in the conditional so the whole repair operation is retried as intended.
            for attempt in 1 2 3; do
              sudo apt-get -o Acquire::Retries=3 update
              if sudo env DEBIAN_FRONTEND=noninteractive \
                apt-get -o Acquire::Retries=3 install -y "${packages[@]}"; then

Comment thread .github/workflows/SDK.Integration.Test.Job.yml Outdated
Use the top-level LXC AppArmor profile, reload systemd units after cache restoration, retry package index failures, and ensure cache action failures flow into explicit verification and repair.

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

Copilot-Session: 52e48fee-23e1-4b05-803c-522812fcdda2
Copilot AI review requested due to automatic review settings August 7, 2026 17:11

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@bbonaby Branden Bonaby (bbonaby) left a comment

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.

Thanks Richie! This should unblock the other PRs in the queue

@richiemsft
Richie Gomez (richiemsft) merged commit 5c31e9c into main Aug 7, 2026
23 checks passed
@richiemsft
Richie Gomez (richiemsft) deleted the harden-linux-sdk-dependencies branch August 7, 2026 17: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