Se0ng11
Se0ng11

Reputation: 2333

Azure resources pipeline and repositories hit error

after I had repositories into the yaml, I hit error of

/pipeline.yml (Line: 5, Col: 17): Pipeline Resource source_pipeline Input Must be Valid.

is it because pipelines or repositories cannot be use at the same time?

trigger: none

resources:
  pipelines:
    - pipeline: source_pipeline
      source: sample-repo-A
      trigger:
        branches:
          - master
          - develop
  repositories:
    - repository: templates
      type: git
      name: sample-repo-B
  

Upvotes: 0

Views: 831

Answers (1)

Kim Xu-MSFT
Kim Xu-MSFT

Reputation: 2216

When you define a pipeline resource, you should follow the below schema:

resources:        # types: pipelines | builds | repositories | containers | packages
  pipelines:
  - pipeline: string  # identifier for the resource used in pipeline resource variables
    project: string # project for the source; optional for current project
    source: string  # name of the pipeline that produces an artifact
    version: string  # the pipeline run number to pick the artifact, defaults to latest pipeline successful across all stages; Used only for manual or scheduled triggers
    branch: string  # branch to pick the artifact, optional; defaults to all branches; Used only for manual or scheduled triggers
    tags: [ string ] # list of tags required on the pipeline to pickup default artifacts, optional; Used only for manual or scheduled triggers
    trigger:     # triggers aren't enabled by default unless you add trigger section to the resource
      branches:  # branch conditions to filter the events, optional; Defaults to all branches.
        include: [ string ]  # branches to consider the trigger events, optional; Defaults to all branches.
        exclude: [ string ]  # branches to discard the trigger events, optional; Defaults to none.
      tags: [ string ]  # list of tags to evaluate for trigger event, optional
      stages: [ string ] # list of stages to evaluate for trigger event, optional

The "source" should be the name of the pipeline, not the name of repo. Check this official link for details: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema

Here is the sample:

resources:
  pipelines:
    - pipeline: My CI # identifier for the resource (used in pipeline resource variables)
      source: source_pipeline
      trigger:
        branches:
          - master
          - develop
  repositories:
    - repository: templates
      type: git
      name: sample-repo-B

Upvotes: 2

Related Questions