admin管理员组文章数量:1291593
I am working on a project that is created as npm library using typescript + angular. As part of unit testing and integration testing of library, i am referencing the consumer application into the library application repository as gitsubmodule. As part of integration testing, i am trying to trigger the pipeline of checked out consumer application submodule code. While doing this, i am getting error for consumerapp/ci/gitlab/pipeline.trunk.yml where file is trying to include another stage file from same folder.
**
Unable to create pipeline
Local file consumerapp/ci/gitlab/stage.dependencies.yml
does not exist!
**
Here is how the folder structure looks for the library workspace.
Library workspace
- consumerapp (checked out via submodule)
- ci/gitlab
pipeline.trunk.yml
stage.dependencies.yml
- library
- ci/gitlab
pipeline.trunk.yml
stage.dependencies.yml
.gitlab-ci.yml
.gitmodule
Here is how the the consumerapp/ci/gitlab/pipeline.trunk.yml looks like from consumerapp
image: node:20.12.2-alpine3.18
variables:
DNS_DEPLOYER_ROLE: "arn:aws:iam::34********12:role/DNSOperations"
include:
- "/consumerapp/ci/gitlab/stage.dependencies.yml”
# this clears all inherited rules from the parent pipeline
workflow:
rules:
- when: always
stages: # List of stages for jobs, and their order of execution
- dependencies
- angular
- validate
- deploy
Here is how the the .gitlab-ci.yml looks like from root workspace repository
variables:
BRANCH_PATTERN: "/^(feature|hotfix|bugfix)\//"
GIT_SUBMODULE_STRATEGY: recursive
stages:
- prepare-submodule
- consumerapp-pipeline-trigger
- library-publish
prepare_submodule:
stage: prepare-submodule
script:
- echo "Initializing and updating submodule..."
- git submodule sync
- git submodule update --init --recursive
artifacts:
paths:
- consumerapp/.gitlab-ci.yml
- consumerapp/ci/gitlab/pipeline.trunk.yml
- consumerapp/ci/gitlab/
- consumerapp/ci/gitlab/*
when: always
expire_in: 1 hour
trigger_consumerapp_pipeline:
stage: consumerapp-pipeline-trigger
variables:
CI_DEBUG_TRACE: "true"
trigger:
include:
- artifact: consumerapp/ci/gitlab/pipeline.trunk.yml
job: prepare_submodule
- artifact: consumerapp/ci/gitlab/*.yml
job: prepare_submodule # Reference the job that generates the artifact
## - local: consumerapp/.gitlab-ci.yml # Path to the downstream pipeline
strategy: depend
on_trunk_change:
stage: library-publish
trigger: # path of child pipeline, need depend strategy so that if child fails parent fails
include: library/ci/gitlab/pipeline.trunk.yml
strategy: depend
variables: # need to pass global parameters you want to children or they don't have access
BR_PATTERN: $BRANCH_PATTERN
CI_DEBUG_TRACE: "true"
rules: # if path matches it will exit (these are if-else's) if no match it will not run (if no rules default behavior is always run)
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: ($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_PIPELINE_SOURCE == "push"
when: always
Tried changing the paths for include section which did not worked.
版权声明:本文标题:git - Error while triggering gitlab ci pipeline from submodule code : Local file does not exist - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741533125a2383874.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论