Search code examples
gitazureazure-devopsazure-pipelinesrepository

Pipeline repository dependency


When you create new CI pipeline you can add agent job and agentless one.

My first question is: why is necessary to select a repository while you create an agentless job? Why is so repository dependent?

Is it possible to create a CI pipeline without selecting a repository?

Thank you in advance

Expecting to create an agentless CI without selecting a git repository in Azure Devops


Solution

  • No, it is not possible to create a (YAML) CI pipeline without a repository. In the YAML case it has to store the YAML file somewhere (right: in the repo).

    In your case, for an agentless job, just use an "empty" repo with only the YAML, which is then perfectly versioned through git ;-)

    Edit

    Based on you recent comments (below):

    I got multiple repositories and in the master branch i configure a verification CI. e.x I got repo x with x_CI-verify and x_CI-build repo y with y_CI-verify and y_CI-build and so on.

    In branch master for each repo i should configure each verify CI. To avoid configuring one by one for each repo the right CI i want to create this 'master CI' which is build, get the repo name(x name) and build the x_CI-verify.

    The best approach is to work with templates. These templates can then be referenced from your X, Y, etc repos.

    [template example]

    You still have create an azure-pipeline.yml in the X, Y repo and use the template:

    resources:
      repositories:
      - repository: templates
        type: git
        name: Build-Templates
    
    extends:
      template: apps.yml@templates
    

    More info about templates, for example the use with parameters, check the documentation here.