Reputation: 13640
Running pipeline from template cause this error: Unexpected type 'SequenceToken' encountered while reading 'resources'. The type 'MappingToken' was expected.
Any idea how to fix it?
pipeline.yaml
trigger: none
resources:
repositories:
- repository: pipeline
type: git
name: MyProject/my-repo
# My feature branch
ref: refs/heads/feature/unit_test
extends:
# Template that I'm extending
template: pipelines/application.yaml@pipeline
Upvotes: 3
Views: 6142
Reputation: 480
I ran into a similar error like this one System.ArgumentException: Unexpected type '' encountered while reading 'action manifest root'. The type 'MappingToken' was expected. at GitHub.DistributedTask.Objec...
My mistake was that I put 'text"
instead of 'text'
or "text"
( typo error)
One typo line was enough to brake my workflow.
Upvotes: 0
Reputation: 13640
I found the problem to this ridiculous error message. It turned out that when you extend pipelines with templates as I did template: pipelines/application.yaml@pipeline
. You MUST get rid of trigger
and resources
keys in pipeline that you are extending it from.
application.yaml - Settings that caused the error.
trigger:
- pipeline
resources:
- repo: self
variables:
commit: '$(Build.SourceVersion)'
imageTag: 'latest'
imageName: 'app-backend'
imageArtifact: '$(imageName):$(imageTag)'
stages:
- template: ../stages/build.yaml
- template: ../stages/test.yaml
application.yaml - Settings that fixed the error.
variables:
commit: '$(Build.SourceVersion)'
imageTag: 'latest'
imageName: 'app-backend'
imageArtifact: '$(imageName):$(imageTag)'
stages:
- template: ../stages/build.yaml
- template: ../stages/test.yaml
Change makes sense since now your pipeline context is relative to your project, rather than the repository that you are extending it from.
Upvotes: 4