Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash changes from job to job #57

Open
boredland opened this issue Aug 13, 2020 · 0 comments
Open

hash changes from job to job #57

boredland opened this issue Aug 13, 2020 · 0 comments

Comments

@boredland
Copy link

boredland commented Aug 13, 2020

hi i have a workflow with multiple jobs:

prepare_workspace:
    runs-on: [self-hosted, high]
    steps:
      - name: install_cache_dependencies
        uses: ktmud/cached-dependencies@v1
        continue-on-error: true
        timeout-minutes: 10
        with:
          caches: ${{ github.workspace }}/.github/runner/caches.js
          bashlib: ${{ github.workspace }}/.github/runner/bashlib.sh
          run: |
            cache-restore yarn
            yarn install --frozen-lockfile --cache-folder yarn_cache
            cache-save yarn

            yarn build --ignore @mobileheadholding/frontend
            cache-save dist
....
somebuild:
   runs-on: [self-hosted, high]
   steps:
       - name: restore_dependencies
         uses: ktmud/cached-dependencies@v1
         continue-on-error: true
         timeout-minutes: 10
         with:
           caches: ${{ github.workspace }}/.github/runner/caches.js
           bashlib: ${{ github.workspace }}/.github/runner/bashlib.sh
           run: |
             cache-restore yarn
             yarn install --frozen-lockfile --cache-folder yarn_cache
             cache-restore dist

my bashlib.sh is empty. the repo is a yarn workspace with with mutiple node_modules per package and one central yarn.lock in the root. my caches.js looks like this:

module.exports = {
  dist: {
    hashFiles: [`${process.env.GITHUB_WORKSPACE}/yarn.lock`],
    keyPrefix: `build-${process.env.SHA_SHORT}-`,
    path: [`${process.env.GITHUB_WORKSPACE}/packages/*/dist`],
  },
  yarn: {
    hashFiles: [`${process.env.GITHUB_WORKSPACE}/yarn.lock`],
    keyPrefix: `node_cache-`,
    path: [
      `${process.env.GITHUB_WORKSPACE}/yarn_cache`,
      `${process.env.GITHUB_WORKSPACE}/packages/*/node_modules`,
      `${process.env.GITHUB_WORKSPACE}/node_modules`,
    ],
  },
};

In the prepare workspace job, this happens:

RESTORE cache for yarn
  {
    "key": "node_cache-bb0f60c22d383a41f4d3950c20b74841563c8e3c0d2b822a9292b696b4814685",
    "path": "/runner/_work/lala/lala/yarn_cache\n/runner/_work/lala/lala/packages/*/node_modules\n/runner/_work/lala/lala/node_modules",
    "restore-keys": "node_cache-"
  }
  Cache Size: ~425 MB (445803354 B)
  /bin/tar -xz -f /runner/_work/_temp/3c78631a-30ee-4b15-b765-ea18712c1fbc/cache.tgz -P -C /runner/_work/lala/lala
  Cache restored from key: node_cache-bb0f60c22d383a41f4d3950c20b74841563c8e3c0d2b822a9292b696b4814685
....
SAVE cache for dist
  {
    "key": "build-c28b9db-e1a99fa0c6e3c7e0295453e15e2ffde982539bb896f3eae11c5a9d7a304d6c3e",
    "path": "/runner/_work/lala/lala/packages/*/dist",
    "restore-keys": "build-c28b9db-"
  }
  [warning]Error retrieving key from state.

BUT in the somebuild job, this happens:

RESTORE cache for yarn
  {
    "key": "node_cache-c40d35d9ab4b712eab3f752dec1f6f46b6849aed82f6a72b3120e3c52626d134",
    "path": "/home/runner/work/lala/lala/yarn_cache\n/home/runner/work/lala/lala/packages/*/node_modules\n/home/runner/work/lala/lala/node_modules",
    "restore-keys": "node_cache-"
  }
  Cache not found for input keys: node_cache-c40d35d9ab4b712eab3f752dec1f6f46b6849aed82f6a72b3120e3c52626d134, node_cache-
....
RESTORE cache for dist
  {
    "key": "build-c28b9db-8b94d46b2e2881a63dd91581c1e9be37e418d5899b716a8b1156534fe9faf565",
    "path": "/home/runner/work/lala/lala/packages/*/dist",
    "restore-keys": "build-c28b9db-"
  }
  Cache not found for input keys: build-c28b9db-8b94d46b2e2881a63dd91581c1e9be37e418d5899b716a8b1156534fe9faf565, build-c28b9db-

So clearly the hash changed between those two. I don't get how that could happen. Interesting enough: the hash suffix even changes between yarn and dist. inside the same job. ideas? Is the jobid somehow part of the hash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant