GitLab CICD Pipeline 作业依赖问题

问题描述 投票:0回答:1

我有这个 Gitlab-ci.yml 文件

.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

在上面,当管道运行时,会出现此错误

Playwright_Test job: undefined dependency: .react_cache

我的另一个问题是,当我只使用更改子句时,它应该在反应的任何文件夹内发生更改时运行,但它不会运行我在这里做错了什么

提前感谢您的帮助

我尝试了上面提到的但没有成功

gitlab gitlab-ci gitlab-ci-runner gitlab-ci.yml gitlab-ci-trigger
1个回答
0
投票

当顶级键前面带有

.
时(这使其成为“隐藏作业”,有时也称为“模板作业”),它们实际上并不运行任何作业。您只能在不以
dependencies:
 开头的实际具体作业上声明 
.

© www.soinside.com 2019 - 2024. All rights reserved.