I have this Gitlab-ci.yml file
.react_cache:
stage: cache
image: registry.gitlab.com/path to my docker image
script:
- cd react-app
- npm install -g yarn
- yarn
- yarn install --frozen-lockfile --no-progress
cache:
key:
files:
- react-app/yarn.lock
Playwright_Test:
stage: test
# only:
# changes:
# - "./react-app/**/*"
image: registry.gitlab.com/path to my other docker image
script:
- cd laravel
- cp .env.testing .env
- composer install
- php artisan key:generate
- php artisan serve --port=80 &
- cd ../react-app/
- npx playwright install
- npx playwright test ../react-app/tests/**/*.spec.ts
services:
- name: mcr.microsoft.com/playwright:bionic
alias: playwright
dependencies:
- .react_cache
in above when the pipeline runs it gives this error
Playwright_Test job: undefined dependency: .react_cache
My other question is that when I use only change clause so it is supposed to be run when something is changed inside any folder of react but it doesn't run what am I doing wrong here
Thanks for help in advance
I tried above mentioned but didn't work
When a top-level key is prepended with a
.
-- that makes it a "hidden job" sometimes also called a 'template job' -- these do not actually run any jobs. You can only declaredependencies:
on actual concrete jobs that do not start with a.
See also: GitLab CI caching examples - NodeJS. Your
cache:
configuration should be defined in the same job that intends to utilize the cache. See also: cache settings per-job.