Reputation: 165
I'm a first time user of Azure Devops and I need to create a CI/CD process for a mono-repo project hosted on Azure Repos. Here's a brief description
RepoA
LinuxProject
FirmwareProject
TestProject
I have a self-hosted Azure agent (RepoABuild) with all the tools installed that I would like to build these projects on.
The requirement of LinuxProject YAML file is
Can Anyone here help me with this requirement or point me to any example ? I would really appreciate your help
Upvotes: 0
Views: 1280
Reputation: 30343
You can follow below steps to create the yaml pipeline for LinuxProject:
1, Create a yaml file and commit to your azure repo (eg.LinuxProject-pipeline.yml).
2, Create a yaml pipeline from your azure project portal.
Sign in to your Azure DevOps organization and navigate to your project.
In your project, navigate to the Pipelines page. Then choose the action to create a new pipeline.
Walk through the steps of the wizard by first selecting Azure Repos Git as the location of your source code.
Walk through the steps of the wizard and Choose Existing Azure Pipelines Yaml file. And select file
LinuxProject-pipeline.yml
created in the 1st step in the prompted window.
3, Add below content to LinuxProject-pipeline.yml file.
trigger:
paths:
include:
- LinuxProject/*
pool: your-self-hosted-agent-pool
steps:
- bash: |
cd RepoA/LinuxProject
source opt/lib/linux/settings.sh
make images
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/LinuxProject/Build
archiveFile: $(Build.ArtifactStagingDirectory)/LinuxProject.zip
In above yaml file, the trigger defines a path filter which makes the pipeline only be triggered when changes happens in folder LinuxProject. See here for more information about trigger
The pool, define its value to the name of agent pool where your self-hosted agent(RepoABuild) resides. (Check this thread to use demands if you have multiple self-hosted agents in the agent pool)
Add bash task to run the bash commands
Add ArchiveFiles task to archive your build result.
You might need to change above yaml file a little bit according to your project. You can refer to below steps to create pipelines for the other two projects.
Please check out the get started document to start with.
Here are the key pipeline basic concepts.
Here is the Yaml schema reference.
Here are the predefined variables you can use in your pipeline directly(eg. $(Build.ArtifactStagingDirectory) in above archive file task refers to foler c:\agent_work\1\a
in your agent machine).
Upvotes: 3