You can use templates, put in the main repo only the minimal yaml
that refers to a template with all the steps, the template exits in another repo.
For example, your main repo yaml
:
resources:
repositories:
- repository: templates
type: git
name: Contoso/BuildTemplates
jobs:
- template: common.yml@templates # Template reference
In in the repo: Contoso/BuildTemplates put the full yaml
:
# Repo: Contoso/BuildTemplates
# File: common.yml
parameters:
vmImage: 'ubuntu 16.04'
jobs:
- job: Build
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- script: npm install
- script: npm test
Restrict the access to the second repo (unless the agent pipeline user).
Read here more info about the resources.