You can manage Multibranch Pipelines in template.yaml
files using the multibranch:
configuration block.
Each multibranch:
configuration block contains the following values:
-
Source control: specifies the source control provider.
-
Orphaned item strategy: specifies the strategy to use for retaining orphaned items.
-
Custom marker file: specifies the custom marker file.
-
Scan repository interval: specifies the scan repository interval.
For more information on Multibranch Pipeline Template syntax, see Multibranch Pipeline Template syntax. |
Customizing the Source Control value
The source control value defines the source control provider and credentials.
You can find examples of the supported source control providers at https://github.com/cloudbees/cloudbees-examples/tree/master/pipeline-template-examples/demos. |
multibranch: branchSource: github: repoOwner: organization.example repository: ${repoName} credentialsId: ${my-team-github-credentials}
multibranch: branchSource: github: apiUri: https://github.example.com/api/v3 repoOwner: organization.example repository: ${repoName} credentialsId: ${my-team-github-credentials}
multibranch: branchSource: git: remote: ${repoUrl} credentialsId: ${my-team-git-credentials}
multibranch: branchSource: bitbucket: serverUrl: https://bitbucket.org repoOwner: organization.example repository: ${repoName} credentialsId: ${my-team-bitbucket-credentials}
multibranch: branchSource: bitbucket: serverUrl: https://bitbucket.example.com repoOwner: organization.example repository: ${repoName} credentialsId: ${my-team-bitbucket-credentials}
Customizing the Orphaned Items Strategy configuration
CloudBees CI includes configuration options to store jobs based on your organization’s retention strategy. By default, jobs are removed as soon as the folder computation determines they are no longer present. However, if your organization requires these items to remain available or you would like to review the build results of a branch after it has been removed, you can configure the orphaned item strategy to store the jobs for however long they’re needed. By default, child multibranch projects inherit the orphaned item strategy of their parent organization folder. If necessary, you can assign a different orphaned item strategy to a child multibranch project than that of the parent organization folder.
Using a custom marker file with templates
You can use a custom marker file with your templates by defining it in the template.yaml
file for your template.
The following examples are intended to show how you could use the default manifest files for different types of projects as a custom marker file. However, you may choose to use whichever file and file type that you wish. |
Examples
name: Multibranch with marker file type: pipeline-template templateType: MULTIBRANCH parameters: - name: repoUrl type: string displayName: Repository multibranch: branchSource: git: remote: ${repoUrl} markerFile: pom.xml
name: Multibranch with marker file type: pipeline-template templateType: MULTIBRANCH parameters: - name: repoUrl type: string displayName: Repository multibranch: branchSource: git: remote: ${repoUrl} markerFile: package.json
name: Multibranch with marker file type: pipeline-template templateType: MULTIBRANCH parameters: - name: repoUrl type: string displayName: Repository multibranch: branchSource: git: remote: ${repoUrl} markerFile: MAKEFILE
name: Multibranch with marker file type: pipeline-template templateType: MULTIBRANCH parameters: - name: repoUrl type: string displayName: Repository multibranch: branchSource: git: remote: ${repoUrl} markerFile: package.xml