Commit graph

200 commits

Author SHA1 Message Date
Rob Taylor 5bddecf9cd Fix dpkg not knowing about packages after cache restore
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)

Adds tests verifying dpkg -s reports packages as installed after both
fresh install and cache restore.

Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
2026-03-10 18:30:37 +00:00
Rob Taylor f6d423e255 Add in-repo action integration tests
Bring the integration tests from the separate cache-apt-pkgs-action-ci
repo into this repo. Tests now use `uses: ./` to test the local checkout
directly, eliminating the need for cross-repo dispatch events.

Tests cover:
- Core workflow: install, restore, cache invalidation, package ordering
- Error handling: empty packages, missing packages, invalid version
- Regression tests: issues #36, #37, #72, #76, #79, #81, #84, #89, #98, #106
- Special cases: multi-arch cache keys, virtual packages

Changes from the external CI tests:
- Uses `uses: ./` instead of `uses: awalsh128/cache-apt-pkgs-action@master`
- Updated checkout to actions/checkout@v4
- Made version-list assertions resilient (grep for expected packages
  rather than exact string match, since dependency versions change
  with Ubuntu updates)
- Improved error-case verification (check outcome != failure rather
  than only running on failure)
- Triggers on push to master/dev/staging and on pull requests

Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
2026-03-10 17:55:01 +00:00
Dane Wilson acb598e5dd
Pin actions for immutable and secure dependency versions (#175)
Pin dependency actions per security best practices.

https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions
2025-10-03 23:35:39 -07:00
Copilot 23602f4229
Add support for third-party PPA repositories via add-repository parameter (#173)
* Initial plan

* Add add-repository parameter support for third-party PPAs

Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>

* Add validation and complete PPA repository support implementation

Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>

* Remove accidentally committed log file and update .gitignore

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>
2025-09-30 01:06:22 -07:00
Copilot 2ae65d5bbf
Fix ls error when no tar files exist in cache restore (#170)
* 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>
2025-09-30 01:06:02 -07:00
awalsh128 9f7a885e33 Support symlinks and their targets. 2025-08-29 21:40:34 -07:00
Takahiro Ueda a605dbde2a
Add empty_packages_behavior option to handle empty package list (#154)
Available options: 'error' (default), 'warn' and 'ignore'.
2025-08-16 19:34:34 -07:00
awalsh128 2c09a5e66d Binary for https://github.com/awalsh128/cache-apt-pkgs-action/pull/160 2025-08-10 17:15:27 -07:00
Sébastien Morais 9a146f43d1
fix: skip invalid lines (#160) 2025-08-10 17:11:12 -07:00
Mike Tesch cbdbab28e6
Automatically append the OS architecture to the cache key (#150) 2025-08-10 13:24:23 -07:00
Andrew Walsh 23ccb675d9
Update README.md 2025-07-07 20:37:29 -07:00
Andrew Walsh db548ecc55
Update README.md 2025-07-07 20:35:48 -07:00
Khyber Sen 4c82c3ccdc
Remove GitHub URL shorteners (git.io) as they no longer work. (#164)
Fixes #163.
2025-07-07 20:15:12 -07:00
awalsh128 7ca5f46d06 Fix exec error. 2025-03-16 14:39:03 -07:00
Andrew Walsh 2330cb6dfb
Add support for virtual packages and break out APT logic into common library. (#155)
* Add support for virtual packages and break out APT logic into common library.
* Update binaries from commit 128de25ccb
2025-03-16 13:05:35 -07:00
Andrew Walsh 128de25ccb
Add support for virtual packages and break out APT logic into common library. (#153) 2025-03-16 12:35:38 -07:00
Bradley Scott 13d2226e13
Avoid using xargs when creating package tarballs (#136) 2025-02-04 10:08:04 -08:00
Ülgen Sarıkavak d1a184e480
Update actions/checkout versions in README (#148) 2025-02-03 11:42:51 -08:00
Jacco Broeren dfe9c8af34
fix: remove timestamps from loglines (#146) 2025-01-23 20:00:46 -08:00
Max Schwenk 5902b33ae2
Upgrade to cache v4 (#140) 2025-01-09 11:16:31 -08:00
Andrew Walsh f2fc6d1af4 Explicitly don't fail on error in library calls (required for conditonals) 2024-03-03 14:39:27 -08:00
Oliver Kopp a6c3917cc9
Add arm64 binary (#127)
* Add support for arm64 APT in Go apt-query binary.
2024-03-01 12:59:14 -08:00
Andrew Walsh 2555a377df
Bump force reload to accommodate update on cache action save version. #122 2024-02-13 21:42:01 -08:00
Hadrien G 75ab37ec52
Use matching versions of actions/cache actions (#123)
Needed to finish migration to node20 + probably wiser overall to use matching versions of the caching actions.
2024-02-13 21:38:36 -08:00
Andrew Walsh a9d925863b
Bump global version of cache.
Force cache reload for new version of cache action.
2024-02-13 11:36:57 -08:00
Daniel Possenriede 5c74a020dc
Bump actions/cache/restore to v4 (#120) 2024-02-01 13:13:10 -08:00
Andrew Walsh 6460a33c29
First version of a Golang version for APT package querying. (#118) (#119)
* 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>
2023-12-22 10:28:03 -08:00
Andrew Walsh 44c33b32f8
Pull staging changes upstream. (#113)
* 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>
2023-10-30 11:12:50 -07:00
Andrew Walsh 6f9e6a86db
Update README.md 2023-10-11 08:11:43 -07:00
Steven Hartland 641f947ac2
fix: apt cache performance (#104)
* 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.
2023-10-11 08:07:11 -07:00
awalsh128 1850ee53f6 Documentation for versioning support. 2023-03-24 04:50:32 -07:00
Andrew Walsh 135ee20306
Merge branch 'dev' into master 2023-03-23 23:51:02 -07:00
awalsh128 0a4812359d Revert package existence test. 2023-03-23 22:58:47 -07:00
awalsh128 6d3c7590b1 Test apt-cache show command wrt versioning. 2023-03-23 22:33:59 -07:00
awalsh128 f5bcdd76d3 Use APT syntax for name version delimitation and not a colon. 2023-03-23 22:19:43 -07:00
awalsh128 cdad971850 Fix broken function calls. 2023-03-23 20:50:29 -07:00
awalsh128 971da5988a Standardize syntax, name casing and fix package versioning feature. 2023-03-23 20:20:24 -07:00
awalsh128 bd5455834e Convert action to APT version syntax. 2023-03-13 21:43:46 -07:00
awalsh128 a644619d1f Enclose filenames in single quotes to capture literals #99 2023-03-13 21:24:13 -07:00
Pascal Roeleven bdc09286d1
Only install apt-fast from source if not present (#97)
* Revert "Don't install apt-fast from source (#96)"

This reverts commit 854bb539e1.

* Only install apt-fast from source if not present
2023-03-08 09:04:22 -08:00
Pascal Roeleven 946776e670
Clean cache directory after use (#95) 2023-03-06 06:56:37 -08:00
Pascal Roeleven 854bb539e1
Don't install apt-fast from source (#96) 2023-03-06 06:54:18 -08:00
John Hughes 797d1a2f52
More robust checking of age of apt cache (#90) 2023-02-11 21:36:46 -08:00
awalsh128 270eae5fc9 Remove commas, and block scalar folded backslashes #84 2023-02-04 21:08:45 -08:00
awalsh128 5b6c3ab114 Add deprecation message to obsolete input. 2023-02-04 20:30:40 -08:00
Andrew Walsh 622a4c5687
Sync dev to master. (#93)
* 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>
2023-02-03 23:16:50 -08:00
awalsh128 e649dfdfe5 Merge branch 'master' of https://github.com/awalsh128/cache-apt-pkgs-action 2023-02-03 12:43:05 -08:00
awalsh128 9ecdf39b43 Introduce a force update value for reloading cache #82 2023-02-03 12:42:50 -08:00
Leroy Hopson 9b2b4f2004
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.
2023-01-16 19:29:46 -08:00
awalsh128 9b3b2b590c Enclose tar files in quotes #79. 2023-01-02 16:49:35 -08:00