Integrate Process into Azure DevOps
You can define a process for your team and set up your CI system to run the tasks in that process as a pipeline in CI using the CI/CD Automation for Simulink Check support package.
In this example, you connect a project to Azure® DevOps and generate a pipeline file for the project and its process model by using the pipeline generator. You can specify the pipeline generator options to create pipelines that separate tasks into different jobs and use other custom pipeline behaviors.
This example shows the recommended way to use your process in Azure DevOps. Alternatively, you can manually author a Azure DevOps pipeline file that opens your project and runs your process. For more information, Approaches to Running Processes in CI.
Set Up Azure DevOps Project and Agent
To set up the CI system, you need to set up a source-controlled remote repository where you store your project and a CI agent machine that can run your pipeline on that repository. For this example, you can use Azure for both your remote repository and CI system, and then create a self-hosted Azure DevOps agent to run your pipelines.
In Azure DevOps, create a Azure Repos repository. For information, see Create a project in Azure DevOps in the Azure DevOps documentation.
Create a Azure DevOps agent. See the Azure DevOps documentation for Azure Pipelines agents .
Install MATLAB®, Simulink®, Simulink Check™, the CI/CD Automation for Simulink Check support package, and any other products that your process requires on the machine that your Azure DevOps agent is running on. Make sure that your Azure DevOps agent machine can access and run MATLAB before you continue.
For information on licensing considerations, Docker® containers, and virtual displays, see Tips for Setting Up CI Agents.
Connect MATLAB Project to Repository and Azure DevOps
To set up your CI system, you need to set up a source-controlled remote repository where you store your MATLAB project and you need to connect that repository to your Azure DevOps project.
For this example, you can set up an Azure repository and allow Azure DevOps to automate a CI pipeline for the project.
Open a project in MATLAB. For this example, open an example project that uses the process defined by an example process model.
processAdvisorExampleStart
The process model,
processmodel.m
, is at the root of the project and defines a process with common model-based design tasks. You can use the Process Advisor app to run the tasks in the process on your local machine. For information on how to create and customize a process model for your development and verification workflow, see Customize Your Process Model.On the Project tab, in the Source Control section, click Remote and specify the URL for the remote origin in Azure where your repository is hosted. For example,
https://dev.azure.com/organization/project/_git/repo
.The example project is already set up to use local Git™ source control. For information on how to use source control with your projects, see Use Source Control with Projects.
Generate Pipeline Configuration File
You generate the Azure pipeline file by using the pipeline generator.
In MATLAB, configure the pipeline generation options by creating a
padv.pipeline.AzureDevOpsOptions
object and specifying the location of your MATLAB installation for your agent.The
padv.pipeline.AzureDevOpsOptions
object stores the options for the pipeline generator. You can modify the other properties of the object to customize how the pipeline generator creates your pipeline configuration file. For example, you can create apadv.pipeline.AzureDevOpsOptions
object for a Azure DevOps agent that uses a MATLAB installation atpath/to/your/matlab/bin
.AzureDevOpsOptions = padv.pipeline.AzureDevOpsOptions; AzureDevOpsOptions.MatlabInstallationLocation = "path/to/your/matlab/bin";
By default,
AzureDevOpsOptions
specifies aSingleStage
pipeline architecture that runs all the tasks in the process within a single stage in CI. To change the number of stages or the grouping of tasks in the CI pipeline, specify thePipelineArchitecture
property of yourpadv.pipeline.AzureDevOpsOptions
object.Generate a pipeline configuration file for your project by calling the
padv.pipeline.generatePipeline
function on yourpadv.pipeline.AzureDevOpsOptions
object.padv.pipeline.generatePipeline(AzureDevOpsOptions)
By default, the generated pipeline configuration file is named
simulink_pipeline.yml
and is located under the project root, in the subfolder derived > pipeline.
Use Pipeline Configuration File in Azure DevOps
To use the generated pipeline configuration file, set up a pipeline in Azure DevOps and configure the pipeline to use the YAML file, as shown in the Azure documentation for Create your first pipeline . You can see your process running in the Pipelines section of Azure DevOps. For more information, see the Azure documentation for View and manage your pipelines.
See Also
padv.pipeline.generatePipeline
| padv.pipeline.AzureDevOpsOptions