Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k 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

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...