Share via

Azure DevOps Pipeline Not Triggering on Code Push

Shobanabarkavi J 0 Reputation points
2024-10-17T11:09:01.5233333+00:00

Hello everyone,

I’m currently working with Azure DevOps and have set up a pipeline in a separate repository from my application code. My pipeline YAML configuration includes the following:

resources:
  repositories:
    - repository: svh-test
      type: git
      name: svh-test
      ref: master
      trigger:
        branches:
          include:
            - master

steps:
  - checkout: self
  - checkout: svh-test

  - script: |
      echo "Pipeline triggered for shareview-health-device-service!"
      echo "Current branch: $(Build.SourceBranch)"
    displayName: 'Echo Trigger Information'

this pipeline is yaml is in separate repo, and svh-test is in separate repo, whenever code pushed to svh-test repo this pipeline is not triggering

Community Center | Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 81,395 Reputation points MVP Volunteer Moderator
    2024-10-17T11:52:17.5533333+00:00

    The issue seems related to how the pipeline triggers are configured when dealing with multiple repositories in Azure DevOps. Check the following

    Repository Settings in YAML:

    The resources.repositories block you are using defines the linked repository (svh-test), but repository resource triggers are not enabled by default. You need to configure the repository resource with a trigger correctly, either through the pipeline triggers settings or explicitly in YAML.

    Example of Correct Trigger Configuration:

    resources:
      repositories:
        - repository: svh-test
          type: git
          name: svh-test
          ref: master
          trigger:
            branches:
              include:
                - master
    

    If the linked repo is in another project, triggers won't work via YAML and must be enabled via a service connection and UI triggers.

    UI Trigger Configuration:

    • If the linked repository is in another project, you need to set up the trigger via the pipeline settings in the Azure DevOps UI.
    • Go to Pipelines > Your Pipeline > Edit.
    • Under Triggers, enable Enable continuous integration for the svh-test repository and select the branches you want to trigger on.

    Permissions and Access:

    • Make sure the pipeline has access to the svh-test repository.
    • Verify that the service connection or repository link has the correct permissions.
    • Ensure that both repositories (pipeline and svh-test) can access each other if they are in different projects or organizations.

    Branch Protection Rules or Delays:

    • If svh-test has branch policies (like requiring approvals), it may block triggers until the policy is satisfied.

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.