GITLAB CI 管道未触发

Raa*_*l L 12 continuous-integration gitlab

我已经为 GitLab CI/CD 编写了这个 yml 文件。有一个已配置并正在运行的共享运行器。我是第一次这样做,不确定我哪里出错了。我在 repo 上的 Angular js 项目有一个 gulp 构建文件,并且在本地计算机上完美运行。此代码只需在我的运行程序所在的虚拟机上触发该代码即可。提交时管道不显示任何作业。让我知道哪些地方需要改正!

image: docker:latest

cache:
  paths:
    - node_modules/

deploy_stage:
  stage: build
  only:
    - master
  environment: stage
  script:
  - rmdir -rf "build"
  - mkdir "build"
  - cd "build"
  - git init
  - git clone "my url"
  - cd "path of cloned repository"
  - gulp build
Run Code Online (Sandbox Code Playgroud)

mak*_*aki 9

你承诺哪个分支?您的管道配置为仅在master分支上提交时运行。

...
  only:
    - master
...
Run Code Online (Sandbox Code Playgroud)

如果您还想为其他分支触发作业,请从.gitlab-ci.yml文件中删除此限制。

不要忘记Enable shared Runners(默认情况下它们可能未启用),可以在 GitLab 项目页面的 下找到设置Settings -> CI/CD -> Runners

更新:您的管道触发器是否适用于您的项目?

如果没有,那么我会尝试配置简单的管道来测试触发器是否正常工作:

test_simple_job:
  script:
    - echo I should execute for any pipeline trigger.
Run Code Online (Sandbox Code Playgroud)


小智 5

我通过将 .gitlab-ci.yaml 重命名为 .gitlab-ci.yml 解决了这个问题