awalsh128 / cache-apt-pkgs-action

Cache APT packages in GitHub Actions
Other
205 stars 35 forks source link

Thoughts on caching `apt update`? #121

Open cha0s opened 9 months ago

cha0s commented 9 months ago

It's cool to cache the packages, but it's a little less cool to have to update the packages every time first if they aren't already in the image.

What are your thoughts on the value and/or feasibility of caching the result of apt update?

awalsh128 commented 9 months ago

How would this be different than the current approach? Do you mean also caching the APT database?

cha0s commented 9 months ago

I have the same requirements as: https://stackoverflow.com/questions/58134793/error-while-loading-shared-libraries-libnss3-so-while-running-gtlab-ci-job-to

Without first running:

sudo apt-get update

the following error occurs:

| 06:39:58.927 resolving package versions...
| 06:39:58.958 resolved
| 06:39:58.959 Package 'libgconf-2-4' not found.
| 06:39:58.961 Package 'libatk1.0-0' not found.
| 06:39:58.962 Package 'libatk-bridge2.0-0' not found.
| 06:39:58.963 Package 'libgtk-3-0' not found.
| 06:39:58.965 Package 'libgbm-dev' not found.
| 06:39:58.966 Package 'libnss3-dev' not found.
| 06:39:58.967 Package 'libxss-dev' not found.
| 06:39:58.969 Package 'libasound2' not found.
[CI/ci]   ❌  Failure - Main ${GITHUB_ACTION_PATH}/pre_cache_action.sh \
  ~/cache-apt-pkgs \
  "$VERSION" \
  "$EXEC_INSTALL_SCRIPTS" \
  "$DEBUG" \
  "$PACKAGES"
echo "CACHE_KEY=$(cat ~/cache-apt-pkgs/cache_key.md5)" >> $GITHUB_ENV
[CI/ci] exitcode '5': failure

I'm not sure if I mean caching the apt database! Maybe?

cha0s commented 9 months ago

Would it be possible to skip apt-cache if there's a cache hit?