gitlab ci不正确合并
大家好,假设这是我的gitlab ci
.gitlab-ci.yml
stages:
- install
- build
before_script:
- nvm install 14.17
- nvm use 14.17
- npm install -g [email protected] --registry=$NPM_REGISTRY
- npm install -g semantic-release
- git fetch --all
include: '/ci/install_stage.yml'
include: '/ci/build_stage.yml'
/ci/install_stage.yml
install:
stage: install
tags:
- fe
- xdev
artifacts:
expire_in: 1 day
paths:
- node_modules/
only:
changes:
- .gitlab-ci.yml
- package.json
- packages/**/*
script:
- yarn install
cache:
key: '$CI_PROJECT_PATH-package'
paths:
- $CI_PROJECT_DIR/node_modules/
/ci/build_stage.yml
build:
stage: build
tags:
- fe
- xdev
artifacts:
expire_in: 1 day
paths:
- $CI_PROJECT_DIR/dist
only:
changes:
- .gitlab-ci.yml
- package.json
- packages/**/*
script:
- yarn build
dependencies:
- install
cache:
key: '$CI_PROJECT_PATH-CI_COMMIT_REF_SLUG-build'
paths:
- $CI_PROJECT_DIR/dist
想要在安装
之后仅运行构建
,这就是为什么我将dependencies
放在build> build> build
job中。但是,皮棉给我错误构建作业不确定的依赖性安装
,
因此在合并之前,Gitlab的皮棉似乎是不小心完成的吗?
无论如何要解决这个问题?谢谢
Hi guys assume this is my gitlab ci
.gitlab-ci.yml
stages:
- install
- build
before_script:
- nvm install 14.17
- nvm use 14.17
- npm install -g [email protected] --registry=$NPM_REGISTRY
- npm install -g semantic-release
- git fetch --all
include: '/ci/install_stage.yml'
include: '/ci/build_stage.yml'
/ci/install_stage.yml
install:
stage: install
tags:
- fe
- xdev
artifacts:
expire_in: 1 day
paths:
- node_modules/
only:
changes:
- .gitlab-ci.yml
- package.json
- packages/**/*
script:
- yarn install
cache:
key: '$CI_PROJECT_PATH-package'
paths:
- $CI_PROJECT_DIR/node_modules/
/ci/build_stage.yml
build:
stage: build
tags:
- fe
- xdev
artifacts:
expire_in: 1 day
paths:
- $CI_PROJECT_DIR/dist
only:
changes:
- .gitlab-ci.yml
- package.json
- packages/**/*
script:
- yarn build
dependencies:
- install
cache:
key: '$CI_PROJECT_PATH-CI_COMMIT_REF_SLUG-build'
paths:
- $CI_PROJECT_DIR/dist
So basically i want to only run build
after install
, thats why i put a dependencies
in build
job. But then the lint give me error build job undefined dependency install
So it seem the lint of Gitlab is done invidually before the merge ?
anyway to fix this ? thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于任何遇到同样问题的人,原因是Gitlab将覆盖
包括
方法,因此,对于我的情况,它仅包括构建,但不包括安装阶段。要修复,我更改为阵列类型
包括:['/ci/install_stage.yml','/ci/build_stage.yml']
For anyone having same problem, the reason is gitlab will overwrite
include
method, therefore, for my case, it only include build but not install stage.To fix, i changed to an array type
include: ['/ci/install_stage.yml', '/ci/build_stage.yml']
从
中includs
文档::因此,您可以更新
.gitlab-ci.yml
这样的文件,以评估所有内容,因此合并之前,build> build
job将知道您的install install
作业:From the
include
documentation :So you can update your
.gitlab-ci.yml
file like this, to evaluate all includes before merging, so thebuild
job will know yourinstall
job :