Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

continuous integration - git pipeline fails with error: needs to match exactly one accessor! (when .gitlab_ci.yml calls a template from another repo)

I am trying to get my gitlab pipeline to call a pipeline template from another repo. Pipeline fails with the following error:

By the way, pipeline succeeds if remove reference to external repo and instead refer to the file in calling repo locally). gitlab-ci-template.yml file exist both in the calling repo and in the called repo.

ERROR:

Found errors in your .gitlab-ci.yml:
Include `{"file":"/gitlab_ci_template.yml"}` needs to match exactly one accessor!
You can also test your .gitlab-ci.yml in CI Lint

My .gitlabci.yml

image:
  name: ubuntu:20.04
  entrypoint:
    - '/usr/bin/env'
    - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

include:
  - project: 'foocompany/sandbox/foo-sandbox/templates/pipelines/test_include_pipeline_source'
  - file: '/gitlab_ci_template.yml'

question from:https://stackoverflow.com/questions/65837918/git-pipeline-fails-with-error-needs-to-match-exactly-one-accessor-when-gitla

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have an extra "-" before "file". You don't need dash in that line.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...