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

Can't access cached npm or pnpm from next job/step (step label: 'npm or pnpm work?') #67

Open
mannycolon opened this issue Jan 11, 2024 · 1 comment
Assignees

Comments

@mannycolon
Copy link

image

common:
  - assume-ops-services-platform-role: &assume-ops-services-platform-role
      role-arn: $CI_ROLE_ARN
  - node-cache: &node-cache
      id: node
      backend: s3
      key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum 'pnpm-lock.yaml' }}"
      restore-keys:
        - 'v1-cache-{{ id }}-{{ runner.os }}-'
        - 'v1-cache-{{ id }}-'
      # compress: true # Optional. Create tar.gz instead of .tar (Compressed) Defaults to `false`.
      # compress-program: gzip # Optional. Allows for custom compression backends - i.e. pigz. Defaults to `gzip`.
      s3:
        bucket: e2-dev-buildkite-cache
        # save-cache: true # Optional. Saves the cache on temp folder and keep between builds/jobs on the same machine.
      paths:
        - node_modules
        - .npm-cache
        - apps/**/node_modules

steps:
 - group: ':open-pull-request: PR Checks'
    if: build.branch != "main"
    steps:
      - label: ':broom: All the things!'
        key: 'pr-checks'
        plugins:
          - *permissions
          - aws-assume-role-with-web-identity: *assume-ops-services-platform-role
          - nienbo/cache#v2.4.15: *node-cache
        commands:
          - '.buildkite/scripts/slack-message-user.sh'
          - 'apk add --no-cache tar' # Required for cache plugin to work correctly
          - 'apk add --update npm'
          - 'npm install -g pnpm'
          - 'pnpm install  --no-prefer-frozen-lockfile'
          - 'pnpm exec nx affected -t prisma-generate ${NX_AFFECTED_PR_OPTS}'
          - 'pnpm exec nx affected -t lint ${NX_AFFECTED_PR_OPTS}'
          - 'pnpm exec nx affected -t test ${NX_AFFECTED_PR_OPTS}'
          - 'pnpm exec nx affected -t build ${NX_AFFECTED_PR_OPTS}'
          # TODO: Add step to check serverless package build
      - wait: ~
      - label: 'npm or pnpm work?'
        key: 'pr-checks2'
        plugins:
          - *permissions
          - aws-assume-role-with-web-identity: *assume-ops-services-platform-role
          - nienbo/cache#v2.4.15: *node-cache
        commands:
          - 'ls -a'
          - 'apk add --update npm'
          - 'pnpm list'
@gencer
Copy link
Collaborator

gencer commented Jan 12, 2024

I'm trying to understand what might goes wrong here by looking your YAML file, however, I'm not sure if the root cause is cache plugin.

For example, what happens when you completely remove cache & restore steps and run pnpm --version (or equivelant) on both steps? It seems bash cannot find the pnpm binary rather than cache/restore issue.

@gencer gencer self-assigned this Jan 12, 2024
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

2 participants