Skip to content

CI: fix ci-deps-canary nightly, add apt-install.sh for unification and robustness - #11629

Open
padelsbach wants to merge 4 commits into
wolfSSL:masterfrom
padelsbach:ci-apt-wrapper
Open

padelsbach wants to merge 4 commits into
wolfSSL:masterfrom
padelsbach:ci-apt-wrapper

Conversation

@padelsbach

@padelsbach padelsbach commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes a failure in the CI image build where an apt package would be omitted from the bundle if it was already present on the host machine. Failure occurred sporadically as GH migrates Ubuntu versions, and the fix applies to any version.

Example: https://github.com/wolfSSL/wolfssl/actions/runs/39548467943

Also, unify several copypasta apt install loops into apt-install.sh. Handles timeouts for robustness in a uniform way.

Testing

CI

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI balanced review requested due to automatic review settings October 2, 2026 00:16

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.

Copilot review overview

🟡 Changes recommended

Zero-value validation and the Falcon job’s insufficient timeout budget undermine the intended robustness.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Centralizes robust apt installation behavior for CI workflows and composite actions.

Changes:

  • Adds a reusable apt installer with retries, timeouts, and vendor-source handling.
  • Migrates CI jobs and dependency-bundle generation to the shared script.
  • Expands SBOM dependencies and avoids amd64 bundles on non-x64 runners.
File Description
.github/​scripts/​apt-install.sh Adds the shared apt installation utility.
.github/​scripts/​download-deb-closure.sh Uses the shared utility for bundle downloads.
.github/​actions/​install-apt-deps/​action.yml Delegates apt fallback and adds architecture gating.
.github/​actions/​ccache-setup/​action.yml Reuses the shared installer for ccache.
.github/​workflows/​sbom.yml Uses bundled apt dependencies for SBOM tooling.
.github/​workflows/​falcon-interop.yml Migrates Falcon jobs to the apt action.
.github/​workflows/​cross-library.yml Bootstraps and uses the installer in containers.
.github/​workflows/​cross-library/​README.md Documents the new bootstrap process.
.github/​workflows/​ci-deps-image.yml Uses the installer when producing dependency bundles.
.github/​workflows/​afalg.yml Uses best-effort shared installation for kernel modules.
.github/​ci-deps/​packages-ubuntu-24.04-full.txt Adds SBOM build dependencies to the full bundle.

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

Comment thread .github/scripts/apt-install.sh Outdated
Comment thread .github/workflows/falcon-interop.yml
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +4 B (+0.0%, 70,431 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +24 B (+0.0%, 130,741 B / 262,144 B, total: 50% used)

gcc-arm-cortex-m4

  • FLASH: .text +64 B (+0.0%, 209,948 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +64 B (+0.0%, 182,463 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +64 B (+0.0%, 194,264 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +8 B, .text +1,088 B (+0.1%, 796,012 B / 1,048,576 B, total: 76% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +64 B (+0.0%, 223,552 B / 262,144 B, total: 85% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +64 B (+0.0%, 311,716 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +64 B (+0.0%, 343,064 B / 1,048,576 B, total: 33% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +64 B (+0.0%, 131,537 B / 262,144 B, total: 50% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +64 B (+0.0%, 249,230 B / 262,144 B, total: 95% used)

gcc-arm-cortex-m7

  • FLASH: .text +64 B (+0.0%, 209,948 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +64 B (+0.0%, 312,612 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +64 B (+0.0%, 249,294 B / 262,144 B, total: 95% used)

linuxkm-pie

  • Data: __patchable_function_entries +64 B (+0.2%, 29,048 B)

linuxkm-standard

  • Data: __patchable_function_entries +72 B (+0.1%, 52,040 B)

stm32-sim-stm32h753

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.

Copilot review overview

🟡 Changes recommended

Existing sparse checkouts omit the shared helper, breaking apt fallback in multiple workflows.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Comment thread .github/actions/install-apt-deps/action.yml Outdated
@padelsbach

Copy link
Copy Markdown
Contributor Author

jenkins retest this please (timeout to be fixed in https://github.com/wolfSSL/testing/pull/1053)

@padelsbach padelsbach changed the title CI: add apt-install.sh for unification and robustness CI: fix ci-deps-canary nightly, add apt-install.sh for unification and robustness Oct 21, 2026
@padelsbach
padelsbach requested a balanced review from Copilot October 21, 2026 18:39

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.

🔵 Needs a closer look

Shared privileged installation and recursive dependency bundling need CI-backed human validation across differing runner package versions.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@padelsbach

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@night1rider night1rider 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.

Two things AI found I thought should be looked at.

Comment thread .github/scripts/download-deb-closure.sh Outdated
Comment on lines 37 to 64
# Bundle exact (=) deps even if installed, as older images may differ.
ARCHIVES=/var/cache/apt/archives
export LC_ALL=C # sort and comm must agree on the order
pinned() {
for deb in "$ARCHIVES"/*.deb; do
dpkg-deb -f "$deb" Pre-Depends Depends
done | sed 's/^[^ ]*: //' | tr ',' '\n' \
| sed -nE 's/^ *([^ :(|]+)(:[^ ]+)? *\(= *([^ )]+)\) *$/\1=\3/p' | sort -u
}
bundled() {
for deb in "$ARCHIVES"/*.deb; do
dpkg-deb -f "$deb" Package Version | sed 's/^[^ ]*: //' | paste -sd=
done | sort -u
}
declare -A tried=()
while :; do
need=()
while read -r pin; do
[ -n "${tried[$pin]:-}" ] || need+=("$pin")
done < <(comm -23 <(pinned) <(bundled))
[ "${#need[@]}" -gt 0 ] || break
echo "Pinned (${#need[@]}): ${need[*]}"
for pin in "${need[@]}"; do
tried[$pin]=1
"$APT_INSTALL" --tries 5 --no-update --warn-only --download-only \
--reinstall "$pin" || skipped=$((skipped+1))
done
done

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.

The PR now bundles a package when a bundled .deb asks for its exact version, so gcc-14-base goes in. But installed packages that pin the old gcc-14-base (libgcc-s1, libstdc++6) have to be upgraded with it, and they are not bundled. On an older runner image the offline install still fails the same way it does without the PR, and the job goes back to the mirror. Should the loop also bundle installed packages that pin a bundled one?

What I ran: I built the bundle for build-essential libtool python3-yaml in ubuntu:24.04 with the script from master and from the PR. Then I installed each one offline (--network none, same apt options as install-apt-deps) into two consumers: the stock image, and the same image with only gcc-14-base, libgcc-s1 and libstdc++6 rolled back to the noble release version. The PR bundle installed fine on the stock image and failed on the older one with exit 100, the same as the master bundle. Adding libgcc-s1 and libstdc++6 to the loop's list fixed it.

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.

Good catch. Updated to parse out the exact version and use it

Comment on lines +205 to +211
# Update gets half of each attempt (20s..90s, apt's 3 x 30s ladder).
PER=$(( ${{ inputs.budget-seconds }} / ${{ inputs.retries }} ))
UPD=$((PER / 2))
[ "$UPD" -le 90 ] || UPD=90
[ "$UPD" -ge 20 ] || UPD=20
INS=$((PER - UPD))
[ "$INS" -ge 40 ] || INS=40

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.

The old loop split what was left of budget-seconds over the attempts still to come, so a fast failure handed its time to the retry. The PR splits the budget evenly up front. With the defaults, a retry after a fast apt-get update failure now gets 210s for install instead of about 505s. Was this change meant, and is 210s enough for the biggest package sets?

What I ran: I ran the step's run: block from master and from the PR with the default inputs (600s, 2 tries). sudo, timeout and sleep were stubs, so the stub timeout printed each limit and faked the run time. With no early failure both gave install 210s. With the first update failing at once and an install that needs 300s, master gave it 510s and passed, and the PR gave it 210s and failed with exit 124. The real figure on master is about 505s, because the stubbed sleep 5 takes no time here.

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.

Updated to split the budget

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