如何在gitlab中自动触发管道

如何在gitlab中自动触发管道,gitlab,Gitlab,最后,我成功地运行了管道,但现在的问题是,我必须在每次推送或提交后手动运行管道,在每次推送或提交后是否可以自动触发管道。这将非常有帮助。多谢各位 image: node:latest services: - mysql:latest - redis:latest - postgres:latest cache: paths: - node_modules/ test_async: script: - npm install - node ./specs/start.js ./specs/as

最后,我成功地运行了管道,但现在的问题是,我必须在每次推送或提交后手动运行管道,在每次推送或提交后是否可以自动触发管道。这将非常有帮助。多谢各位

image: node:latest
services:
- mysql:latest
- redis:latest
- postgres:latest
cache:
paths:
- node_modules/
test_async:
script:
 - npm install
 - node ./specs/start.js ./specs/async.spec.js
test_db:
script:
- npm install
 - node ./specs/start.js ./specs/db-postgres.spec.js

如果您将gitlab-ci.yml文件添加到项目中,它应该在推送后自动运行。如果要检查CI,请使用

yourgitlaburl/ci/lint

它将告诉您语法是否正确,并解释您的CI

此外,您的CI缩进不正确:

image: node:latest
services:
- mysql:latest
- redis:latest
- postgres:latest
cache:
  paths:
  - node_modules/
test_async:
  script:
  - npm install
  - node ./specs/start.js ./specs/async.spec.js
test_db:
  script:
  - npm install
  - node ./specs/start.js ./specs/db-postgres.spec.js

你能发布你的
gitlab ci.yml
文件吗?这应该是自动完成的,除非你做了一些改变,据我所知。感谢上帝有人回答。。。我默认使用简单的nodejs模板。我已经添加了.yml文件我不明白为什么它不起作用。。如果在中添加一个名为
test
in的阶段会发生什么情况,如图所示?正如我所说的,它是默认格式,我尝试做的只是触发一条管道是的,我知道它会自动运行,但在我的情况下它不是。我还使用clint进行了检查,结果显示没有错误。