Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point to specific commit on referenced repository for Azure Pipelines build

Our team uses an Azure DevOps Pipeline that runs based on the code in another repository. We have a yaml file written within our repository that references the other repository for our Azure DevOps Pipeline as follows:

resources:
  repositories:
  - repository: e2e_fx
    type: github
    name: Azure/iot-sdks-e2e-fx
    ref: refs/heads/master
    endpoint: 'GitHub OAuth'

jobs:
- template: vsts/templates/jobs-gate-c.yaml@e2e_fx

Currently the yaml points to the head of master for the other repository, so if a new commit is added to that remote repository then it will be pointed to. I want to be able to reference a specific commit from the repository referenced. How can I do that?

For reference, I've already tried copying the specific commit I want to reference and pasting it where refs/heads/master is right now, but that gave an error.

like image 536
yodama Avatar asked May 15 '19 21:05

yodama


People also ask

How do I checkout with multiple repositories in Azure pipelines?

Specify multiple repositoriesRepositories can be specified as a repository resource, or inline with the checkout step. The following repository types are supported. Only Azure Repos Git ( git ) repositories in the same organization as the pipeline are supported for multi-repo checkout in Azure DevOps Server 2020.

How do you trigger one pipeline from another Azure DevOps?

To trigger a pipeline upon the completion of another pipeline, configure a pipeline resource trigger. The following example configures a pipeline resource trigger so that a pipeline named app-ci runs after any run of the security-lib-ci pipeline completes. This example has the following two pipelines.


1 Answers

Currently there is no option to do it out-of-the-box in the .yaml file.

You can configure the .yaml to not sync sources, then the build will not download the repository, and in the beginning of the build add a Command Line task to download only the commit yo want.

To tell the .yaml not to sync sources in the steps: add - checkout: none:

steps:
- checkout: none # Don't sync sources
like image 170
Shayki Abramczyk Avatar answered Oct 06 '22 23:10

Shayki Abramczyk