core icon indicating copy to clipboard operation
core copied to clipboard

Fix cache use of node executable

Open spbolton opened this issue 8 months ago • 0 comments

Not all github actions jobs use maven and the maven-frontend-plugin are restoring the cached node executables. This means that it will make extra calls to download and extract these resources. It also mean there can be extra areas where there are problems with download and then failure

An example of the failure is in this run.

https://github.com/dotCMS/core/actions/runs/9348464062/job/25728292884#step:6:433

[INFO] --- frontend:1.12.1:install-node-and-yarn (install node and yarn) @ dotcms-nodejs-parent ---
[INFO] Installing node version v18.18.2
[INFO] Downloading https://nodejs.org/dist/v18.18.2/node-v18.18.2-linux-x64.tar.gz to /home/runner/.m2/repository/com/github/eirslett/node/18.18.2/node-18.18.2-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /home/runner/.m2/repository/com/github/eirslett/node/18.18.2/node-18.18.2-linux-x64.tar.gz into /home/runner/work/core/core/installs/node/tmp
Error:  The archive file /home/runner/.m2/repository/com/github/eirslett/node/18.18.2/node-18.18.2-linux-x64.tar.gz is corrupted and will be deleted. Please try the build again.

The following steps are required to properly use and set the cache and are needed for any step that will be running dotcms-core-web or dotcms-postman modules that use the frontend maven module.

- name: Cache Node Binary
        id: cache-node-binary
        uses: actions/cache@v4
        with:
          path: |
            installs
          key: node-binary-${{ hashFiles('core-web/.nvmrc') }}
      - name: Cache yarn
        id: cache-yarn
        uses: actions/cache@v4
        with:
          path: |
            ~/.cache/yarn
          # if specific cache does not exist then can base upon latest version
          key: yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: yarn-

spbolton avatar Jun 03 '24 14:06 spbolton