Contenido principal

Integrate Process into Azure DevOps

This example shows how to integrate your process into Azure® DevOps by using pipeline generator version 1. Pipeline generator version 2 is recommended for enhanced file propagation and artifact management capabilities. The setup and requirements for pipeline generator version 2 are shown in Process Integration and Artifact Management for Azure DevOps.

Pipeline Generator Version 1

In this example, you connect a project to Azure DevOps and generate a Azure DevOps CI pipeline file for the project and its process model by using version 1 of the pipeline generator. You specify the pipeline generator options to create pipelines that separate tasks into different jobs and use other custom pipeline behaviors.

Set Up Azure DevOps Project and Agent

To set up the CI system, you must set up a source-controlled remote repository where you store your project and a build agent 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.

  1. In Azure DevOps, create a Azure Repos repository. For information, see Create a project in Azure DevOps in the Azure DevOps documentation.

  2. Create a Azure DevOps agent. See the Azure DevOps documentation for Azure Pipelines agents .

  3. Install MATLAB®, Simulink®, Simulink Check™, the CI Support Package for Simulink, 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 must set up a source-controlled remote repository where you store your MATLAB project and you must 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.

  1. 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.

  2. Connect your project, remote repository, and CI platform by adding the remote URL to your local repository. For more information, see Share Git Repository to Remote. Typically a remote URL has the format https://dev.azure.com/organization/project/_git/repo.

Generate Pipeline Configuration File

You generate the Azure pipeline file by using the pipeline generator.

  1. 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 a padv.pipeline.AzureDevOpsOptions object for a Azure DevOps agent that uses a MATLAB installation at path/to/your/matlab/bin.

    AzureDevOpsOptions = padv.pipeline.AzureDevOpsOptions;
    AzureDevOpsOptions.MatlabInstallationLocation = "path/to/your/matlab/bin";

    By default, AzureDevOpsOptions specifies a SingleStage 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 the PipelineArchitecture property of your padv.pipeline.AzureDevOpsOptions object.

  2. Generate a pipeline configuration file for your project by calling the padv.pipeline.generatePipeline function on your padv.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

|

Topics