From eff081df6c88aa44fcafd16c4efc374997dc5003 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:15:40 -0500 Subject: [PATCH 01/10] feat: new apt_cache options (default ~/.apt) --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 3120fa8..dbccc9c 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,10 @@ branding: icon: 'folder' color: 'orange' inputs: + apt_cache: + description: 'Location (directory) of the user-space apt cache.' + required: false + default: '~/.apt' cvmfs_alien_cache: description: 'If set, use an alien cache at the given location.' required: false @@ -336,6 +340,7 @@ runs: shell: bash env: ACTION_PATH: ${{ github.action_path }} + APT_CACHE: ${{ inputs.apt_cache }} CVMFS_ALIEN_CACHE: ${{ inputs.cvmfs_alien_cache }} CVMFS_ALT_ROOT_PATH: ${{ inputs.cvmfs_alt_root_path }} CVMFS_AUTHZ_HELPER: ${{ inputs.cvmfs_authz_helper }} From 8347c078b46409a9cdb84c7de8ae6ee9cff9289f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:16:11 -0500 Subject: [PATCH 02/10] feat: new lsb-release step --- action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action.yml b/action.yml index dbccc9c..a7c8261 100644 --- a/action.yml +++ b/action.yml @@ -335,6 +335,15 @@ inputs: runs: using: "composite" steps: + - id: lsb-release + run: | + source /etc/lsb-release + echo "::set-output name=id::${DISTRIB_ID}" + echo "::set-output name=release::${DISTRIB_RELEASE}" + echo "::set-output name=codename::${DISTRIB_CODENAME}" + echo "::set-output name=description::${DISTRIB_DESCRIPTION}" + echo "::set-output name=id-release::${DISTRIB_ID}-${DISTRIB_DESCRIPTION}" + shell: bash - run: | ${{ github.action_path }}/setup-cvmfs.sh shell: bash From 08732afab41b26bc82c259036a80f3a1d3dcd553 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:16:57 -0500 Subject: [PATCH 03/10] feat: cache inputs.apt_cache by lsb_release's id-release --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index a7c8261..c8f497c 100644 --- a/action.yml +++ b/action.yml @@ -344,6 +344,11 @@ runs: echo "::set-output name=description::${DISTRIB_DESCRIPTION}" echo "::set-output name=id-release::${DISTRIB_ID}-${DISTRIB_DESCRIPTION}" shell: bash + - uses: actions/cache@v3 + with: + key: cvmfs-apt-cache-${{ steps.lsb-release.outputs.id-release }}-${{ hashFiles('action.yml') }} + path: | + ${{ inputs.apt_cache }} - run: | ${{ github.action_path }}/setup-cvmfs.sh shell: bash From 5187000ecc143c0c975d3bb338708602f5e5fb6b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:17:32 -0500 Subject: [PATCH 04/10] feat: do not rm deb files --- setup-cvmfs.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index 74163e5..f437eb3 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -6,13 +6,11 @@ if [ "$(uname)" == "Linux" ]; then sudo dpkg -i cvmfs-release-latest_all.deb sudo apt-get -q update sudo apt-get -q -y install cvmfs - rm -f cvmfs-release-latest_all.deb if [ "${CVMFS_CONFIG_PACKAGE}" == "cvmfs-config-default" ]; then sudo apt-get -q -y install cvmfs-config-default else curl -L -o cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} sudo dpkg -i cvmfs-config.deb - rm -f cvmfs-config.deb fi elif [ "$(uname)" == "Darwin" ]; then # Warn about the phasing out of MacOS support for this action From c757fe680d9bf276395daaafefd0123f976b4ce1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:18:58 -0500 Subject: [PATCH 05/10] feat: download deb files to system apt/archives --- setup-cvmfs.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index f437eb3..8839ef0 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -1,16 +1,22 @@ #!/usr/bin/env bash -#Platform specific install +# Platform specific install if [ "$(uname)" == "Linux" ]; then - curl -L -o cvmfs-release-latest_all.deb ${CVMFS_UBUNTU_DEB_LOCATION} - sudo dpkg -i cvmfs-release-latest_all.deb + # install cvmfs release package + APT_ARCHIVES=/var/cache/apt/archives/ + if [ ! -f ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ] ; then + sudo curl -L -o ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ${CVMFS_UBUNTU_DEB_LOCATION} + fi + sudo dpkg -i ${APT_ARCHIVES}/cvmfs-release-latest_all.deb + # install cvmfs package sudo apt-get -q update sudo apt-get -q -y install cvmfs + # install cvmfs config package if [ "${CVMFS_CONFIG_PACKAGE}" == "cvmfs-config-default" ]; then sudo apt-get -q -y install cvmfs-config-default else - curl -L -o cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} - sudo dpkg -i cvmfs-config.deb + sudo curl -L -o ${APT_ARCHIVES}/cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} + sudo dpkg -i ${APT_ARCHIVES}/cvmfs-config.deb fi elif [ "$(uname)" == "Darwin" ]; then # Warn about the phasing out of MacOS support for this action From 17e0da5837a017ae9663463c7548b9b77ee144a9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:19:23 -0500 Subject: [PATCH 06/10] feat: download and upload to APT_CACHE --- setup-cvmfs.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index 8839ef0..da6a102 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -2,6 +2,12 @@ # Platform specific install if [ "$(uname)" == "Linux" ]; then + # download from cache + if [ -n "${APT_CACHE}" ]; then + mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ + sudo cp -r ${APT_CACHE}/archives /var/cache/apt + sudo cp -r ${APT_CACHE}/lists /var/lib/apt + fi # install cvmfs release package APT_ARCHIVES=/var/cache/apt/archives/ if [ ! -f ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ] ; then @@ -18,6 +24,9 @@ if [ "$(uname)" == "Linux" ]; then sudo curl -L -o ${APT_ARCHIVES}/cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} sudo dpkg -i ${APT_ARCHIVES}/cvmfs-config.deb fi + # update cache (avoid restricted partial directories) + cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ + cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ elif [ "$(uname)" == "Darwin" ]; then # Warn about the phasing out of MacOS support for this action echo "::warning::The CernVM-FS GitHub Action's support for MacOS will be \ From dc6d9d9750396b91247731b6e4fd96ca9b5e8817 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 2 Aug 2022 19:50:55 -0500 Subject: [PATCH 07/10] fix: don't fail if APT_CACHE unset --- setup-cvmfs.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index da6a102..5e8fb4d 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -25,8 +25,10 @@ if [ "$(uname)" == "Linux" ]; then sudo dpkg -i ${APT_ARCHIVES}/cvmfs-config.deb fi # update cache (avoid restricted partial directories) - cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ - cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ + if [ -n "${APT_CACHE}" ]; then + cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ + cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ + fi elif [ "$(uname)" == "Darwin" ]; then # Warn about the phasing out of MacOS support for this action echo "::warning::The CernVM-FS GitHub Action's support for MacOS will be \ From 566fcad2abd79380c55d31fff872231d8310e56e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 6 Aug 2022 23:11:51 -0500 Subject: [PATCH 08/10] feat: print contents of cache path before storing --- setup-cvmfs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index 5e8fb4d..2188065 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -26,6 +26,7 @@ if [ "$(uname)" == "Linux" ]; then fi # update cache (avoid restricted partial directories) if [ -n "${APT_CACHE}" ]; then + mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ fi From 8c23644462ef5c5a1f7277eda0468eef00e5eb19 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 7 Aug 2022 14:03:46 -0500 Subject: [PATCH 09/10] feat: add info lines on cache copying --- setup-cvmfs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index 2188065..09fa9e7 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -4,6 +4,7 @@ if [ "$(uname)" == "Linux" ]; then # download from cache if [ -n "${APT_CACHE}" ]; then + echo "Copying cache from ${APT_CACHE} to system locations..." mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ sudo cp -r ${APT_CACHE}/archives /var/cache/apt sudo cp -r ${APT_CACHE}/lists /var/lib/apt @@ -26,6 +27,7 @@ if [ "$(uname)" == "Linux" ]; then fi # update cache (avoid restricted partial directories) if [ -n "${APT_CACHE}" ]; then + echo "Copying cache from system locations to ${APT_CACHE}..." mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ From 2c7a8598735dff943cdea48af1f96d77c389428e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 7 Aug 2022 18:33:50 -0500 Subject: [PATCH 10/10] fix: default apt_cache option to apt_cache dir --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c8f497c..8362388 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: apt_cache: description: 'Location (directory) of the user-space apt cache.' required: false - default: '~/.apt' + default: 'apt_cache' cvmfs_alien_cache: description: 'If set, use an alien cache at the given location.' required: false