Main Content

padv.pipeline.JenkinsOptions

Options for generating pipeline files for Jenkins

    Description

    Use the padv.pipeline.JenkinsOptions object to specify options for generating Jenkins® pipeline files. To generate pipeline files, pass the object to the padv.pipeline.generatePipeline function.

    Creation

    Description

    options = padv.pipeline.JenkinsOptions(GeneratorVersion=version) creates configuration options for generating a Jenkins pipeline using the specified pipeline generator version.

    • Use GeneratorVersion=1 if you need to maintain compatibility with existing pipelines.

    • Use GeneratorVersion=2 for new pipelines or when upgrading your pipeline setup.

    example

    options = padv.pipeline.JenkinsOptions(___,PropertyName=Value) sets properties using one or more name-value arguments.

    Some properties are available in Both Versions, while other properties are specific to Version 1 Only or Version 2 Only.

    Input Arguments

    expand all

    Pipeline generator version, specified as either:

    • 1Pipeline Generator Version 1 provides compatibility with the original pipeline generator functionality. Use GeneratorVersion=1 if you need to maintain compatibility with existing pipelines. For more information, see Integrate Process into Jenkins.

    • 2Pipeline Generator Version 2 contains several improvements to pipeline file propagation, generated pipeline file size, and integration with artifact management systems. Use GeneratorVersion=2 for new pipelines or when upgrading your pipeline setup. For more information, see Process Integration and Artifact Management for Jenkins.

    Properties

    expand all

    Both Versions

    Jenkins agent that executes pipeline, specified as a string or string array.

    Pipeline Generator Version 1 ignores this property if the UseSameExecutorForSequentialStages property is true.

    Example: "high_memory"

    Data Types: string

    Specify whether Jenkins uses MATLAB Plugin to launch MATLAB, specified as either a numeric or logical 0 (false) or 1 (true).

    • When 0 (false):

      • Pipeline Generator Version 1 generates a pipeline that runs tasks using the specified ShellEnvironment.

      • Pipeline Generator Version 2 ignores the ShellEnvironment property. If the agent is a UNIX® machine, the generated pipeline uses a shell script to launch MATLAB. If the agent is not a UNIX machine, the generated pipeline uses a Windows® batch script.

    • When 1 (true), the pipeline runs tasks using the runMATLABCommand step from the MATLAB Plugin to launch MATLAB and the pipeline generator ignores the MatlabLaunchCmd and MatlabStartupOptions properties.

      0 (false)

    Note

    If you dry run tasks by setting DryRun to true in RunprocessCommandOptions, the pipeline does not use the plugin and runs tasks using shell commands.

    Data Types: logical

    Command to start MATLAB program, specified as a string.

    If you use a custom command to launch MATLAB on your machine, make sure to set this property. The default value of this property is "matlab", which assumes MATLAB is available in the PATH environment variable for your system and runs the default MATLAB executable.

    The pipeline generator ignores this property when UseMatlabPlugin is true.

    Example: "C:\Program Files\MATLAB\R2024b\bin\matlab.exe"

    Data Types: string

    Command-line startup options for MATLAB, specified as a string.

    Use this property to specify the command-line startup options that the generated pipeline file uses when starting the MATLAB program. By default, the pipeline generator launches MATLAB using the -batch option. If you need to run MATLAB without the -batch option, specify the property AddBatchStartupOption as false.

    Some MATLAB code, including some built-in tasks, can only run successfully if a display is available for your machine. For more information, see Set Up Virtual Display Machines Without Displays.

    The pipeline generator ignores this property when UseMatlabPlugin is true.

    Example: "-nodesktop -logfile mylogfile.log"

    Data Types: string

    Specify whether to open MATLAB using -batch startup option, specified as a numeric or logical 0 (false) or 1 (true).

    If you need to launch MATLAB with options that are not compatible with -batch, specify AddBatchStartupOption as false.

    Data Types: logical

    Number of stages and grouping of tasks in CI pipeline, specified as either:

    • padv.pipeline.Architecture.SingleStage — The pipeline has a single stage, named Runprocess, that runs each of the tasks in the process.

      Example pipeline graphic that shows one stage that runs all tasks on all models

    • padv.pipeline.Architecture.SerialStages — The pipeline has one stage for each task iteration in the process.

      Example pipeline graphic that shows one stage that runs TaskA on ModelA, one stage that runs TaskA on ModelB, one stage that runs TaskB on ModelA, and one stage that runs TaskB on ModelB

    • padv.pipeline.Architecture.SerialStagesGroupPerTask — The pipeline has one stage for each task in the process.

      Example pipeline graphic that shows one stage that runs one task, TaskA, and one stage that runs another task, TaskB

    • padv.pipeline.Architecture.IndependentModelPipelines— The pipeline contains parallel, downstream pipelines for each model. Each downstream pipeline independently runs the tasks associated with that model. To make sure the jobs run in parallel, make sure that you either have multiple build agents available or configure your build agent to run parallel jobs.

      Example pipeline graphic showing two parallel downstream pipelines. One pipeline that runs tasks on ModelA. One pipeline that runs tasks on ModelB.

    Note

    You must have at least two Jenkins executors available. The pipeline generator requires one executor to generate the pipeline and load the children stages and at least one other executor to execute those stages. If you decide to run model tasks in parallel using the pipeline architecture IndependentModelPipelines, you need additional executors to handle each of the generated parallel pipelines. For information on defining Jenkins executors, see the Jenkins documentation for Managing Nodes.

    For Pipeline Generator Version 1, if you choose a pipeline architecture other than SingleStage, the pipeline generator can create complex Jenkinsfile files that exceed size limits. If Jenkins generates the error Method too large, consider simplifying the pipeline architecture to use the SingleStage architecture instead or upgrade to Pipeline Generator Version 2 as shown in Process Integration and Artifact Management for Jenkins.

    For Pipeline Generator Version 2, if you decide to use the IndependentModelPipelines architecture to generate code and perform code analysis tasks in parallel, you must either switch to using the template parallel process model or update your existing process as shown in Considerations for Parallel Code Generation. These updates allow the tasks in your pipeline to properly handle shared utilities and code generated across parallel jobs.

    Example: padv.pipeline.Architecture.IndependentModelPipelines

    Example: "IndependentModelPipelines"

    Options for runprocess command, specified as a padv.pipeline.RunProcessOptions object.

    The object padv.pipeline.RunProcessOptions has properties for each of the name-value arguments in the runprocess function, except for the Scope arguments Tasks, Process, Subprocesses, and FilterArtifact.

    Note

    GenerateJUnitForProcess is set to false by default in padv.pipeline.RunProcessOptions. Previously, this property was true by default.

    The GenerateJUnitForProcess property in padv.pipeline.JenkinsOptions will be removed in a future release. Make sure to specify the GenerateJUnitForProcess property in padv.pipeline.RunProcessOptions to the value that you want the pipeline to use.

    Example: padv.pipeline.RunProcessOptions()

    Stop running pipeline after stage fails, specified as either:

    • 1 (true) — Stop the pipeline immediately when any stage fails.

    • 0 (false) — Allow the pipeline to continue running subsequent stages, even if a previous stage fails.

    If you use the built-in tasks padv.builtin.task.RunTestsPerModel or padv.builtin.task.RunTestsPerTestCase to run tests, keep StopOnStageFailure set to false. This prevents the pipeline from skipping the padv.builtin.task.MergeTestResults task if a test stage fails.

    Data Types: logical

    File name of generated Jenkins pipeline file, specified as a string.

    By default, the generated pipeline file generates into the subfolder derived > pipeline, relative to the project root. To change where the pipeline file generates, specify GeneratedPipelineDirectory.

    Example: "padv_generated_pipeline_file"

    Data Types: string

    Location where the generated pipeline file generates, specified as a string.

    By default, the generated pipeline file is named "simulink_pipeline". To change the name of the generated pipeline file, specify the GeneratedJenkinsFileName property.

    Example: fullfile("derived","pipeline","test")

    Data Types: string

    When to collect build artifacts, specified as:

    • "never", 0, or false — Never collect artifacts

    • "on_success" — Only collect artifacts when the pipeline succeeds

    • "on_failure" — Only collect artifacts when the pipeline fails

    • "always", 1, or true — Always collect artifacts

    Example: "on_failure"

    Data Types: logical | string

    Name of ZIP file for job artifacts, specified as a string.

    Example: "my_job_artifacts.zip"

    Data Types: string

    Generate Process Advisor build report, specified as a numeric or logical 1 (true) or 0 (false).

    Data Types: logical

    File format for the generated report, specified as one of these values:

    • "pdf" — PDF file

    • "html" — HTML report, packaged as a zipped file that contains the HTML file, images, style sheet, and JavaScript® files of the report

    • "html-file" — HTML report, consisting of a single HTML file that contains the text, style sheets, JavaScript, and base64-encoded images of the report

    • "docx"Microsoft® Word document

    Name and path of generated report, specified as a string array.

    By default, the report path uses a relative path to the project root and the pipeline generator generates a report ProcessAdvisorReport.pdf.

    As a recommended practice, set the ReportPath to a sub-folder within the project root. CI pipelines cannot archive files located in the project root itself.

    Example: "$PROJECTROOT$/PA_Results/Report/ProcessAdvisorReport"

    Data Types: string

    Enable integration with OpenTelemetry to view detailed pipeline timing and execution data, specified as a numeric or logical true (1) or false (0).

    Before you enable the OpenTelemetry integration, you must install the OpenTelemetry-MATLAB package and set up OpenTelemetry, as shown in Collect Detailed Execution Data with OpenTelemetry Integration.

    With the integration, each Jenkins build produces an OpenTelemetry trace that shows the detailed timing and execution data for each stage and step in your pipeline.

    Data Types: logical

    Version 1 Only

    The pipeline generator does not use this property.

    Enable pipeline caching to support incremental builds in CI, specified as a numeric or logical 0 (false) or 1 (true).

    For Pipeline Generator Version 1, generated pipelines use caching by default to help the performance of incremental builds in CI. However, if a generated pipeline has persistent conflicts and generates errors when merging artifact information from parallel jobs, you can disable pipeline caching by specifying EnablePipelineCaching as 0 (false). Disabling pipeline caching increases build times, but can help avoid merge conflicts.

    Pipeline Generator Version 2 ignores this property.

    Data Types: logical

    Path to MATLAB installation location, specified as a string.

    For Pipeline Generator Version 1, make sure the path that you specify uses the MATLAB root folder location and file separators for the operating system of your build agent.

    Pipeline Generator Version 2 ignores this property. For Pipeline Generator Version 2, make sure MATLAB is available on the system PATH so the build agent can access MATLAB.

    Example: "C:\Program Files\MATLAB\R2025a\bin"

    Example: "/usr/local/MATLAB/R2025a/bin"

    Example: "/Applications/MATLAB_R2025a.app/bin"

    Data Types: string

    Shell environment Jenkins uses to launch MATLAB, specified as one of these values:

    • "bat" — Windows batch script

    • "sh" — Shell script

    • "pwsh" — PowerShell Core script

    • "powershell" — Windows PowerShell script

    • "" — Automatically use "bat" or "sh" based on the platform where pipeline generation runs

    Pipeline Generator Version 2 ignores this property and instead:

    • If the agent is a UNIX machine, the Jenkins pipeline uses a shell script.

    • If the agent is not a UNIX machine, the Jenkins pipeline uses a Windows batch script.

    Data Types: string

    Use the same executor for sequential stages, specified as either a numeric or logical:

    • true (1) — By default, Pipeline Generator Version 1 configures sequential stages to use the same executor, minimizing executor usage and maintaining a shared workspace. When generating a Jenkins pipeline from a parent Jenkinsfile, the sequential stages use the same executor that you defined in the top-level node('labelName') block of the parent Jenkinsfile and ignore the AgentLabel property. For more information, see Integrate Process into Jenkins.

    • false (0) — Pipeline Generator Version 1 configures the pipeline to allow Jenkins to release the current agent and potentially use different agents for subsequent stages. This approach can lead to smaller, more manageable jobs, but can require additional pipeline execution time. Since different agents can use different workspaces, Pipeline Generator Version 1 stores the outputs from each stage and passes those outputs to the subsequent stages. For more information on sequential stages, see the Jenkins documentation for Sequential Stages.

    Pipeline Generator Version 2 ignores this property.

    Data Types: logical

    Version 2 Only

    Path to root folder of support packages on build agent, specified as a string.

    You can find this location by using the function matlabshared.supportpkg.getSupportPackageRoot on the build agent.

    Note

    If you specify this property, you must also specify the variable MW_SUPPORT_PACKAGE_ROOT in your CI system.

    Pipeline Generator Version 1 does not support this property.

    Example: "C:\\ProgramData\\MATLAB\\SupportPackages\\R2025a\\bin"

    Data Types: string

    Relative path from repository root to project root folder, specified as a string.

    If your project root folder is at the repository root, leave RelativeProjectPath as an empty string "".

    If your project is located in a subfolder, set RelativeProjectPath to the subfolder path relative to the repository root. The value of RelativeProjectPath must be the portion of the project path after the repository root and must be a valid sub-path within the full path to the project root folder. The path must end with the file separator /.

    For example:

    SituationProject Root FolderValid RelativeProjectPath
    Project in repository repo"/home/user/repo-root"""
    Project in subfolder"/home/user/repo-root/src/myproject""src/myproject/"

    Note

    If you specify this property, you must also specify the variable MW_RELATIVE_PROJECT_PATH in your CI system. The path must end with the file separator /.

    Pipeline Generator Version 1 does not support this property.

    Example: "src/myproject/"

    Example: "subfolder/src/myproject/"

    Data Types: string

    Name of remote build cache directory, specified as a string.

    The pipeline generator uses the directory to store pipeline artifact caches on the remote build cache service. The artifacts and sub-folders are inside a root folder. You can specify the name of the root folder by using the RemoteBuildCacheName property.

    For example, inside your artifact storage location, the pipeline generator can generate a folder structure such as:

    <RemoteBuildCacheName>/
    └── branchName/
        └── folderForEachRunId/
            └── folderForEachTaskIteration/
                ├── Project/
                    ├── PA_Results/
                    ├── derived/
                │       └── artifacts.dmr
            ├── ir_dag.json
            ├── simulink_pipeline
    └── __lastSuccessfulRunId__

    As a best practice, use a unique name for each pipeline and project to avoid conflicts between different pipelines.

    Example: "Jenkins MATLAB Pipeline"

    Data Types: string

    Artifact storage approach, specified as one of the values in this table. The artifact service mode determines how the pipeline stores and retrieves artifact caches. Depending on which approach you choose, you must also specify the additional properties and credentials in the Requirements column.

    ValueDescriptionRequirements
    "network"

    Store artifacts on a network drive

    Set the NetworkStoragePath property.

    "jfrog"

    Store artifacts in a JFrog Artifactory repository

    Set both the ArtifactoryUrl and ArtifactoryRepoName properties.

    In your CI system, save your JFrog API token as a secret with the ID ARTIFACTORY_API_TOKEN_SECRET.

    "s3"

    Store artifacts in an Amazon S3™ bucket

    Set both the S3BucketName and S3AwsAccessKeyID properties.

    In your CI system, save your Amazon S3 access key as a secret with the ID S3_AWS_SECRET_ACCESS_KEY_SECRET.

    "azure_blob"Store artifacts in an Azure® Blob Storage container

    Set the AzContainerName property.

    In your CI system, save your Azure storage account connection string as a secret with the ID AZ_CONNECTION_STRING_SECRET.

    Pipeline Generator Version 1 does not support this property.

    Path to network storage location for storing artifacts when ArtifactServiceMode is "network", specified as a string.

    Specify the path to a shared network location that all agents running the pipeline can access.

    Pipeline Generator Version 1 does not support this property.

    Example: "/artifactManagement/cacheStorage"

    Data Types: string

    URL of JFrog Artifactory server for storing artifacts when ArtifactServiceMode is "jfrog", specified as a string.

    Pipeline Generator Version 1 does not support this property.

    Example: "http://localhost:8082/artifactory"

    Data Types: string

    Name of JFrog Artifactory repository for storing artifacts when ArtifactServiceMode is "jfrog", specified as a string.

    Pipeline Generator Version 1 does not support this property.

    Example: "example-repo-local"

    Data Types: string

    Name of the Amazon S3 bucket for storing artifacts when ArtifactServiceMode is "s3", specified as a string.

    Pipeline Generator Version 1 does not support this property.

    Example: "my-artifacts-bucket"

    Data Types: string

    AWS access key ID for storing artifacts in an Amazon S3 bucket when ArtifactServiceMode is "s3", specified as a string.

    Pipeline Generator Version 1 does not support this property.

    Example: "AKIAIOSFODNN7EXAMPLE"

    Data Types: string

    Name of Azure Blob Storage container for storing artifacts when ArtifactServiceMode is "azure_blob", specified as a string.

    You can only specify a single container name, not multiple container names.

    Pipeline Generator Version 1 does not support this property.

    Example: "mycontainer"

    Data Types: string

    Execution environment of runner, specified as either:

    • "default" — Runs tasks directly on the host machine without containerization.

    • "container" — Runs tasks inside a containerized environment, such as a Docker® container. Specify the container by using the ImageTag property.

      The container does not use MATLAB actions. Make sure to specify the UseMatlabPlugin, MatlabLaunchCmd, MatlabStartupOptions, and AddBatchStartupOption properties as required by your setup. For example:

      op = padv.pipeline.JenkinsOptions(GeneratorVersion=2);
      % Docker image settings
      op.UseMatlabPlugin = false;
      op.MatlabLaunchCmd = "xvfb-run -a matlab -batch"; 
      op.MatlabStartupOptions = "";
      op.AddBatchStartupOption = false;

    Pipeline Generator Version 1 does not support this property.

    Full name of the container image that the generated pipeline uses when RunnerType is "container", specified as a string. Optionally, you can specify arguments for the container image by using the ImageArgs property.

    The image must be an OCI-compliant image, such as a Docker image.

    Pipeline Generator Version 1 does not support this property.

    Example: "mycompany/pipeline-runner:latest"

    Data Types: string

    Arguments for container image that the generated pipeline uses when RunnerType is "container", specified as a string.

    Pipeline Generator Version 1 does not support this property.

    Example: "-e MLM_LICENSE_FILE=27000@MyLicenseServer"

    Data Types: string

    Branches to check for cached build artifacts, specified as a string.

    To support incremental builds, the pipeline generator attempts to restore the cache from the last successful run on the same branch. If no cache is available, the pipeline checks for cached build artifacts on the branches that you specify. By default, the fallback branch is main, but you can specify multiple fallback branches and the pipeline checks each one in order. If the pipeline generator does not find a cache on the specified branches, the pipeline runs a full build, executing each task in the process without skipping tasks. For more information, see How Pipeline Generation Works.

    Pipeline Generator Version 1 does not support this property.

    Example: ["develop"]

    Example: ["main","develop"]

    Data Types: string

    Examples

    collapse all

    This example code shows how to generate a Jenkins pipeline file in MATLAB using Pipeline Generator Version 1. However, typically, you configure your options object and call the pipeline generator from inside a Jenkins CI pipeline file. For a complete example, see Integrate Process into Jenkins.

    Note

    Pipeline Generator Version 1 is provided for compatibility with the original pipeline generator functionality. Pipeline Generator Version 2 is recommended for enhanced file propagation and artifact management, but requires you to update your setup and workflow.

    Load a project. For this example, you can load a Process Advisor example project.

    processAdvisorExampleStart

    Represent your pipeline generator options by creating a padv.pipeline.JenkinsOptions object for pipeline generator version 1.

    op = padv.pipeline.JenkinsOptions(GeneratorVersion=1);

    Generate a pipeline file.

    padv.pipeline.generatePipeline(op)
    The pipeline generator generates a Jenkins CI pipeline file, simulink_pipeline, for the current project, process model, and pipeline generator options.

    This example code shows how to configure and generate a Jenkins pipeline file using Pipeline Generator Version 2 and network artifact storage. For the complete example, see Process Integration and Artifact Management for Jenkins.

    Inside your generate_jenkins_pipeline.m file, you can use a shared network location for your artifacts by specifying the NetworkStoragePath property. For this example, suppose you have a shared network location /artifactManagement/cacheStorage.

    % Copyright 2025 The MathWorks, Inc.
    
    function generate_jenkins_pipeline()
        workspace = string(getenv('WORKSPACE'));
        supportPackageRoot = string(getenv('MW_SUPPORT_PACKAGE_ROOT'));
        relativeProjectPath = string(getenv('MW_RELATIVE_PROJECT_PATH'));
        remoteBuildCacheName = string(getenv('MW_REMOTE_BUILD_CACHE_NAME'));
        pipelineGenDirectory = string(getenv('MW_PIPELINE_GEN_DIRECTORY'));
    
        cp = openProject(strcat(workspace,filesep,string(relativeProjectPath)));
        op = padv.pipeline.JenkinsOptions;
        op.AgentLabel = "my-jenkins-agent-label";
        op.PipelineArchitecture = "SerialStagesGroupPerTask";
        op.GeneratorVersion = 2;
        op.SupportPackageRoot = supportPackageRoot;
        op.GeneratedPipelineDirectory = pipelineGenDirectory;
        op.StopOnStageFailure = true;
        op.RunprocessCommandOptions.GenerateJUnitForProcess = true;
        op.ReportPath = "$PROJECTROOT$/PA_Results/Report/ProcessAdvisorReport";
        op.RelativeProjectPath = relativeProjectPath;
        op.RemoteBuildCacheName = remoteBuildCacheName;
    
        op.ArtifactServiceMode = 'network';
        op.NetworkStoragePath = '/artifactManagement/cacheStorage';
    
        padv.pipeline.generatePipeline(op, "CIPipeline");
    end
    Note that this example code uses an example Jenkins agent label of "my-jenkins-agent-label".

    This example code shows how to configure and generate a Jenkins pipeline file using Pipeline Generator Version 2 and JFrog Artifactory. For the complete example, see Process Integration and Artifact Management for Jenkins.

    Inside your generate_jenkins_pipeline.m file, you can use a JFrog Artifactory repository for your artifacts by specifying the ArtifactServiceMode property as "jfrog" and specifying the properties ArtifactoryUrl and ArtifactoryRepoName.

    % Copyright 2025 The MathWorks, Inc.
    
    function generate_jenkins_pipeline()
        workspace = string(getenv('WORKSPACE'));
        supportPackageRoot = string(getenv('MW_SUPPORT_PACKAGE_ROOT'));
        relativeProjectPath = string(getenv('MW_RELATIVE_PROJECT_PATH'));
        remoteBuildCacheName = string(getenv('MW_REMOTE_BUILD_CACHE_NAME'));
        pipelineGenDirectory = string(getenv('MW_PIPELINE_GEN_DIRECTORY'));
    
        cp = openProject(strcat(workspace,filesep,string(relativeProjectPath)));
        op = padv.pipeline.JenkinsOptions;
        op.AgentLabel = "my-jenkins-agent-label";
        op.PipelineArchitecture = "SerialStagesGroupPerTask";
        op.GeneratorVersion = 2;
        op.SupportPackageRoot = supportPackageRoot;
        op.GeneratedPipelineDirectory = pipelineGenDirectory;
        op.StopOnStageFailure = true;
        op.RunprocessCommandOptions.GenerateJUnitForProcess = true;
        op.ReportPath = "$PROJECTROOT$/PA_Results/Report/ProcessAdvisorReport";
        op.RelativeProjectPath = relativeProjectPath;
        op.RemoteBuildCacheName = remoteBuildCacheName;
    
        op.ArtifactServiceMode = 'jfrog';
        op.ArtifactoryUrl = 'http://localhost:8082/artifactory';
        op.ArtifactoryRepoName = 'example-repo-local';
    
        padv.pipeline.generatePipeline(op, "CIPipeline");
    end
    Note that this example code uses an example Jenkins agent label of "my-jenkins-agent-label".

    This example code shows how to configure and generate a GitLab® pipeline file using Pipeline Generator Version 2 and Amazon S3 storage. For the complete example, see Process Integration and Artifact Management for Jenkins.

    Inside your generate_jenkins_pipeline.m file, you can use Amazon S3 storage for your artifacts by specifying the ArtifactServiceMode property as "s3" and specifying the properties S3BucketName and S3AwsAccessKeyID.

    % Copyright 2025 The MathWorks, Inc.
    
    function generate_jenkins_pipeline()
        workspace = string(getenv('WORKSPACE'));
        supportPackageRoot = string(getenv('MW_SUPPORT_PACKAGE_ROOT'));
        relativeProjectPath = string(getenv('MW_RELATIVE_PROJECT_PATH'));
        remoteBuildCacheName = string(getenv('MW_REMOTE_BUILD_CACHE_NAME'));
        pipelineGenDirectory = string(getenv('MW_PIPELINE_GEN_DIRECTORY'));
    
        cp = openProject(strcat(workspace,filesep,string(relativeProjectPath)));
        op = padv.pipeline.JenkinsOptions;
        op.AgentLabel = "my-jenkins-agent-label";
        op.PipelineArchitecture = "SerialStagesGroupPerTask";
        op.GeneratorVersion = 2;
        op.SupportPackageRoot = supportPackageRoot;
        op.GeneratedPipelineDirectory = pipelineGenDirectory;
        op.StopOnStageFailure = true;
        op.RunprocessCommandOptions.GenerateJUnitForProcess = true;
        op.ReportPath = "$PROJECTROOT$/PA_Results/Report/ProcessAdvisorReport";
        op.RelativeProjectPath = relativeProjectPath;
        op.RemoteBuildCacheName = remoteBuildCacheName;
    
        op.ArtifactServiceMode = 's3';
        op.S3BucketName = 'my-artifacts-bucket';
        op.S3AwsAccessKeyID = 'AKIAIOSFODNN7EXAMPLE';
    
        padv.pipeline.generatePipeline(op, "CIPipeline");
    end
    Note that this example code uses an example Jenkins agent label of "my-jenkins-agent-label".

    This example code shows how to configure and generate a GitLab pipeline file using Pipeline Generator Version 2 and Azure Blob Storage. For the complete example, see Process Integration and Artifact Management for Jenkins.

    Inside your generate_jenkins_pipeline.m file, you can use Azure Blob Storage for your artifacts by specifying the ArtifactServiceMode property as "azure_blob" and specifying the property AzContainerName.

    % Copyright 2025 The MathWorks, Inc.
    
    function generate_jenkins_pipeline()
        workspace = string(getenv('WORKSPACE'));
        supportPackageRoot = string(getenv('MW_SUPPORT_PACKAGE_ROOT'));
        relativeProjectPath = string(getenv('MW_RELATIVE_PROJECT_PATH'));
        remoteBuildCacheName = string(getenv('MW_REMOTE_BUILD_CACHE_NAME'));
        pipelineGenDirectory = string(getenv('MW_PIPELINE_GEN_DIRECTORY'));
    
        cp = openProject(strcat(workspace,filesep,string(relativeProjectPath)));
        op = padv.pipeline.JenkinsOptions;
        op.AgentLabel = "my-jenkins-agent-label";
        op.PipelineArchitecture = "SerialStagesGroupPerTask";
        op.GeneratorVersion = 2;
        op.SupportPackageRoot = supportPackageRoot;
        op.GeneratedPipelineDirectory = pipelineGenDirectory;
        op.StopOnStageFailure = true;
        op.RunprocessCommandOptions.GenerateJUnitForProcess = true;
        op.ReportPath = "$PROJECTROOT$/PA_Results/Report/ProcessAdvisorReport";
        op.RelativeProjectPath = relativeProjectPath;
        op.RemoteBuildCacheName = remoteBuildCacheName;
    
        op.ArtifactServiceMode = 'azure_blob';
        op.AzContainerName = 'mycontainer';
    
        padv.pipeline.generatePipeline(op, "CIPipeline");
    end
    Note that this example code uses an example Jenkins agent label of "my-jenkins-agent-label".

    Version History

    expand all