[workflow] Fix pbuilder cache permission error
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Mon, 15 Apr 2024 08:52:33 +0000 (17:52 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 18 Apr 2024 02:56:48 +0000 (11:56 +0900)
- Currently pbuilder workflow does not use stored cache for permission
  error. This commit resolve the issue.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
.github/workflows/pdebuild.yml

index 3a27fd2..cfe8ae8 100644 (file)
@@ -52,6 +52,9 @@ jobs:
         echo "Rebuild required: ${rebuild}"
         echo "rebuild=${rebuild}" >> "$GITHUB_ENV"
     - uses: actions/setup-python@v1
+    - name: make cache dir for pbuilder
+      ## prevent permission error
+      run: sudo mkdir --mode a=rwx --parents /var/cache/pbuilder
     - name: make cache key
       if: env.rebuild == '1'
       id: make-key
@@ -62,7 +65,9 @@ jobs:
       if: env.rebuild == '1'
       uses: actions/cache@v3
       with:
-        path: /var/cache/pbuilder
+        path: |
+          /var/cache/pbuilder/aptcache
+          /var/cache/pbuilder/base.tgz
         key: ${{ steps.make-key.outputs.cache_key }}
     - name: prepare pdebuild
       if: env.rebuild == '1'
@@ -77,6 +82,9 @@ jobs:
         cat ~/.pbuilderrc
         sudo mkdir -p /root/
         sudo ln -s ~/.pbuilderrc /root/
+    - name: make pbuilder base.tgz
+      if: steps.cache-pbuilder.outputs.cache-hit != 'true'
+      run: |
         echo "=== pbuilder create"
         echo "::group::pbuilder create --allow-untrusted"
         sudo pbuilder create --allow-untrusted