Gitlab 管道不会在存储库根目录中使用 .gitlab-ci.yml 文件激活



我的CI/CD使用GitLab。我有一个Firebase应用程序,我正试图在其中部署功能。但是,即使使用.gitlab-ci.yml文件,管道也不会激活/创建。我已经启用了共享运行程序,我的代码在我的dev分支中,我在ci文件中引用了它。

我的文件夹结构看起来像(在repo的根目录下有.gitlab-ci.yml文件(:

- .gitlab-ci.yml
- project
- functions
- ...
- src
- ...

我的gitlab-ci.yml文件:

image: node:12.13.0-alpine
variables:
ENV: "dev"
before_script:
- npm i -g firebase-tools
stages:
- build
- deploy
DeployFunctions:
stage: deploy
script:
- cd project/functions
- npm install
- cd ..
- firebase deploy --only functions --token $TBT_DEV_FIREBASE_CI
only:
refs:
- dev
changes:
- functions/**/*

当我使用GitLab CI lint对文件进行lint时;模拟为默认分支"创建的管道;,语法似乎是正确的。然而,当我选择该选项时,我会得到以下错误:

No stages / jobs for this pipeline.

当我添加Builder作业,即以下块时,一切正常:

...
stages:
- build
- deploy
Builder:
stage: build
script:
- echo "Commencing build"
DeployFunctions:
stage: deploy
script:
...

这让我相信我没有正确定义DeployFunctions作业。有人能看到它出了什么问题吗?

非常感谢您的帮助!提前感谢!

没有创建管道这一事实似乎是only: refs标记的问题。我把你的文件翻了一遍,语法是正确的。

您的CI文件是否包含在开发分支中?就我而言,只要在dev分支上跟踪.gitlab-ci.yml并将其推送到该分支,它就应该工作。你都做了吗?

在从.gitlab-ci.yml文件中删除一些配置后,我能够创建管道。最后,我删除了整个only块。不知怎的,这个块下的配置是错误的,包括only下的changes块,尽管在许多.gitlab-ci.yml示例中可以看到相同的配置。

image: node:12.13.0-alpine
before_script:
- npm i -g firebase-tools
stages:
- deploy
DeployFunctions:
stage: deploy
script:
- cd project/functions
- npm install
- cd ..
- firebase deploy --only functions --token $DEV_FIREBASE_CI

最新更新