After cache restore, dpkg had no record of the installed packages because:
1. Only preinst/postinst scripts were cached from /var/lib/dpkg/info/,
missing .list, .md5sums, .conffiles, and other metadata files
2. The dpkg status database (/var/lib/dpkg/status) was never updated
This meant dpkg -s, apt list --installed, and anything checking package
state would not see the restored packages.
Fix:
- Cache all /var/lib/dpkg/info/<package>.* files (not just install scripts)
- Save each package's dpkg status entry to a .dpkg-status file
- On restore, append status entries to /var/lib/dpkg/status (skipping
packages that are already registered)
Additionally:
- Include directories in tar archives so that tar preserves their ownership
and permissions on restore (prevents 0077 umask issues on GPU runners)
- Include architecture qualifier (e.g., :i386) from apt's Unpacking log
in get_installed_packages, so multi-arch variants get separate cache
entries instead of being deduplicated
- When registering restored packages with dpkg, compare cached vs installed
versions and handle upgrades by replacing the old status entry
Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
* Initial plan
* Fix ls error when no tar files exist in cache restore
Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>
* Pull dev upstream to staging. (#112)
* Use awk to enclose filename in single quotes tar #99
* Add null field separator so filenames don't get broken up.
* Move upload logs up in the action sequence so it captures data before it gets deleted.
* Fix awk (#109)
---------
Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
* Fix awk delimiter.
Pull in fix by @sn-o-w in d0ee83b497 mentioned in issue #99
* Swap out Bash based APT query logic for Golang version. (#117)
* First version of a Golang version of command handling in general. (#118)
---------
Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
* Pull dev upstream to staging. (#112)
* Use awk to enclose filename in single quotes tar #99
* Add null field separator so filenames don't get broken up.
* Move upload logs up in the action sequence so it captures data before it gets deleted.
* Fix awk (#109)
---------
Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
* Fix awk delimiter.
Pull in fix by @sn-o-w in d0ee83b497 mentioned in issue #99
---------
Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
* fix: apt cache performance
Use a single call to apt-cache to reduce the time needed to lookup
package versions.
Also:
* Added millisecond details to log timing so slow operations can be more
easily identified.
* Perform apt update before determining package versions.
Fixes#103
* chore: descriptive variable names and use log_err
Added the review feedback, updating variable names to be more
descriptive and using log_err where appropriate.
* Address block style package issue #84#88
* Use cache key for upload artifact name #89.
* Sync master back to dev. (#92)
* Fix if condition for upload-logs step (#87)
Previously the if condition was always evaluating to a truthy string
(e.g. 'false == "true"' or 'true == "true"') as the string comparison
(`== 'true'`) was not inside the expression syntax (`${{ }}`) and thus
being treated as a string rather than being evaluated.
* Introduce a force update value for reloading cache #82
---------
Co-authored-by: Leroy Hopson <github@leroy.geek.nz>
---------
Co-authored-by: Leroy Hopson <github@leroy.geek.nz>
Previously the if condition was always evaluating to a truthy string
(e.g. 'false == "true"' or 'true == "true"') as the string comparison
(`== 'true'`) was not inside the expression syntax (`${{ }}`) and thus
being treated as a string rather than being evaluated.