Skip to content

Commit 10197e0

Browse files
authored
Merge pull request #60 from cvmfs-contrib/cache-lists-optional
Caching of apt lists now opt-in (`apt_cache_full`)
2 parents 461cb9e + 68fd4c7 commit 10197e0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'Location (directory) of the user-space apt cache.'
99
required: false
1010
default: 'apt_cache'
11+
apt_cache_full:
12+
description: 'If set to yes, cache APT package lists in addition to .deb packages. This speeds up the action, but may require manual intervention to clear the cache when gh actions runner images are updated'
13+
required: false
14+
default: 'no'
1115
cvmfs_alien_cache:
1216
description: 'If set, use an alien cache at the given location.'
1317
required: false
@@ -362,6 +366,7 @@ runs:
362366
env:
363367
ACTION_PATH: ${{ github.action_path }}
364368
APT_CACHE: ${{ inputs.apt_cache }}
369+
APT_CACHE_LISTS: ${{ inputs.apt_cache_full }}
365370
CVMFS_ALIEN_CACHE: ${{ inputs.cvmfs_alien_cache }}
366371
CVMFS_ALT_ROOT_PATH: ${{ inputs.cvmfs_alt_root_path }}
367372
CVMFS_AUTHZ_HELPER: ${{ inputs.cvmfs_authz_helper }}

setup-cvmfs.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ if [ "$(uname)" == "Linux" ]; then
66
if [ -n "${APT_CACHE}" ]; then
77
echo "::group::Using cache"
88
echo "Copying cache from ${APT_CACHE} to system locations..."
9-
mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/
9+
mkdir -p ${APT_CACHE}/archives/
1010
sudo cp -r ${APT_CACHE}/archives /var/cache/apt
11-
sudo cp -r ${APT_CACHE}/lists /var/lib/apt
11+
if [ "${APT_CACHE_LISTS}" == "yes" ]; then
12+
mkdir -p ${APT_CACHE}/lists/
13+
sudo cp -r ${APT_CACHE}/lists /var/lib/apt
14+
fi
1215
echo "::endgroup::"
1316
fi
1417
# install cvmfs release package
@@ -37,9 +40,12 @@ if [ "$(uname)" == "Linux" ]; then
3740
if [ -n "${APT_CACHE}" ]; then
3841
echo "::group::Updating cache"
3942
echo "Copying cache from system locations to ${APT_CACHE}..."
40-
mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/
43+
mkdir -p ${APT_CACHE}/archives/
4144
cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/
42-
cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/
45+
if [ "${APT_CACHE_LISTS}" == "yes" ]; then
46+
mkdir -p ${APT_CACHE}/lists/
47+
cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/
48+
fi
4349
echo "::endgroup::"
4450
fi
4551
elif [ "$(uname)" == "Darwin" ]; then

0 commit comments

Comments
 (0)