Pipeline sources are a key component of data processing and integration systems. They capture and transfer data from various data sources.
Background information
Flow supports the configuration of code sources, artifact sources, and Flow pipeline sources. It allows you to set up multiple sources.
Code source: Supports common code sources including Codeup, GitHub, GitLab.
Artifact source: Supports Alibaba Cloud DevOps Packages sources and Alibaba Cloud Container Registry (ACR) Enterprise Edition image sources.
Flow pipeline source: Supports configuring other Flow pipelines as sources, allowing pipelines to trigger each other’s execution.
Examples
Single pipeline source
The following is an example of a simple pipeline source configuration:
sources:
my_repo:
type: codeup
name: Code Source Name
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git
branch: master
triggerEvents:
- push
- tagPush
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
Multiple pipeline sources
The following is an example of a multiple pipeline source configuration:
sources:
repo1:
type: codeup
name: Code Source Name
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/repo1.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
triggerEvents:
- push
- tagPush
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
repo2:
type: codeup
name: Code Source Name
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/repo2.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
triggerEvents:
- push
- tagPush
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
defaultWorkspace: repo1Packages source example
The following is an example of configuring an Apsara DevOps Packages generic artifact as a pipeline source:
sources:
my_packages:
type: packages
repoType: generic # Repository type. Only the generic artifact repository is supported.
repo: "<your-repo-id>, eg: flow_generic_repo" # Repository ID. You can get the repository ID from the basic information of the repository on the packages.aliyun.com page.
artifact: "<your-artifact-name>, eg: Artifacts_1418394" # Artifact name.
version: "<your-artifact-version>, eg: 2024-03-28-11-53-39" # Artifact version. If you enter 'latest', the latest version is used.
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>ACR source example
The following is an example of configuring an Alibaba Cloud ACR Enterprise Edition image as a pipeline source:
sources:
my_acr:
type: acr
region: cn-hangzhou
instance: "<your-acr-ee-instance>, eg: yunxiao" # ACR instance name.
namespace: default # Namespace.
imageRepo: "<your-docker-registry>, eg: test" # Image repository name.
imageTag: v1.0 # Image version.
versionFilter: .* # Filter rule for the image version. Enter a regular expression.
triggerEvents:
- pushCompleted
- scanCompleted
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
Flow pipeline source example
The following is an example of configuring a Flow pipeline as a pipeline source:
sources:
ci_pipeline:
type: flowPipeline
name: Flow Pipeline Source Name
flowPipeline: <your-flow-pipeline-id> # For example: rfkkfe6tj1mcaqtz
build: lastSuccessfulBuild
triggerEvents: buildSuccess
Detailed description
sources
Pipeline sources support configuring multiple source entries, including source type, source address, and default branch.
defaultWorkspace
This parameter is required when the pipeline has multiple code sources. If a workspace is not specified for pipeline tasks, the tasks automatically run in the specified default workspace. Enter a specific <source_id> to specify. For example:
sources:
repo1:
......
repo2:
......
defaultWorkspace: repo1
sources.<source_id>
Required. The ID of the pipeline source. When the pipeline runs, the source files are downloaded to the <source_id> directory. The path is /root/workspace/<source_id>. ACR image sources are not downloaded.
The source_id can contain only letters, digits, and underscores (_). It must start with a letter and be no more than 30 characters long.
sources.<source_id>.type
Required. The type of the pipeline source. Flow supports various pipeline source types, such as Codeup, GitHub, GitLab, SVN, , packages, and ACR.
Pipeline source type | YAML identifier | Remarks |
Sample code source | gitSample |
|
Alibaba Cloud DevOps Codeup | codeup |
|
Generic Git | git |
|
GitHub | githubApp |
|
GitLab | gitlab |
|
Self-hosted GitLab | customGitlab |
|
Bitbucket | bitbucket |
|
Flow pipeline | flowPipeline |
|
Packages generic artifact | packages |
|
Alibaba Cloud ACR Enterprise Edition image repository | acr |
|
sources.<source_id>.name
Optional. The display name of the pipeline source. The name can be up to 30 characters long.
sources.<source_id>.endpoint
This parameter is required when the pipeline source is a code source. It specifies the address of the code source. Both SSH and HTTPS addresses are supported. For example: https://codeup.aliyun.com/abc/Codeup-Demo.git.
Sample code repositories are provided by Apsara DevOps. The code source addresses are as follows:
Java: https://atomgit.com/flow-example/spring-boot.git
Go: https://atomgit.com/flow-example/go-gonic.git
Python: https://atomgit.com/flow-example/python-tornado.git
C++: https://atomgit.com/flow-example/gcc-helloworld.git
NodeJS: https://atomgit.com/flow-example/node-expressjs.git
PHP: https://atomgit.com/flow-example/php-laravel-blog.git
.Net Core: https://atomgit.com/flow-example/dotnet-core-sample.gitsources.<source_id>.branch
Optional. Specifies the default branch of the code source. If this parameter is not set, the default value is master. This branch is used when the pipeline is triggered by a schedule or an external system. Enter the branch name. For example:
sources:
my_repo:
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: masterSample code sources only support the master branch.
sources.<source_id>.branchesFilter
Optional. Specifies the filter rule for the branches that can run the pipeline. Enter a regular expression. Only branches or tags that match the filter rule can trigger a pipeline run. This rule applies to all trigger types, including manual, code source, scheduled, and webhook triggers.
sources:
my_repo:
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: release
branchesFilter: release_* # Only branches that start with release_ can run.sources.<source_id>.submodule
Optional. This parameter specifies whether to clone submodules when the pipeline source is a code source. The default value is false. Enter true or false. For example:
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
submodule: truesources.<source_id>.cloneDepth
Optional. When the pipeline source is a code source, this parameter specifies the number of recent commit versions to clone. By default, all versions are cloned. A custom clone depth can speed up workspace preparation. A value of 0 indicates that all versions are cloned. You can enter an integer greater than or equal to 0. For example:
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
cloneDepth: 10sources.<source_id>.triggerSecret
Only for GitHub.
After you add a Secret to the webhook configuration in GitHub, you must add the same value to the pipeline configuration. This is used to verify the signature when the webhook is processed.
You can enter the value directly or use a variable. For example:
triggerSecret: ${SECRET}Or:
triggerSecret: theSecretsources.<source_id>.triggerEvents
Optional. Specifies the source events that trigger the pipeline. By default, the pipeline is not triggered by source events. The pipeline runs only when a configured event occurs.
Triggering event | YAML identifier | Remarks |
Code push | push | |
Tag creation | tagPush | Only for some code sources. |
Merge request completion | mergeRequestMerged | Only for some code sources. |
Merge request creation or update | mergeRequestOpenedOrUpdate | Only for some code sources. |
Pipeline run success | buildSuccess | Only for Flow pipeline sources. |
Pipeline run failure | buildFail | Only for Flow pipeline sources. |
Pipeline run cancellation | buildCancel | Only for Flow pipeline sources. |
ACR image push completion | pushCompleted | Only for ACR pipeline sources. |
ACR image scan completion | scanCompleted | Only for ACR pipeline sources. |
For example:
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
triggerEvents:
- push
- tagPushsources.<source_id>.branchFilter (Deprecated)
This keyword is deprecated. Use sources.<source_id>.branchesFilter instead.
Optional. When the pipeline source is a code source and code commit triggers are enabled, you can set branch filter conditions. By default, branches are not filtered. The pipeline runs only when the conditions are met. Enter a branch name. Regular expressions are supported. For example:
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
triggerEvents: push
branchFilter: ^feature.* # This keyword is deprecated. Use branchesFilter instead.
sources.<source_id>.pathFilter
Optional. When the pipeline source is a code source and code commit triggers are enabled, you can set code path filter conditions. By default, code paths are not filtered. The pipeline runs only when code files in the specified path are committed. Enter a code path. Regular expressions are supported. For example: The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
triggerEvents: push
pathFilter: ^file_path.*sources.<source_id>.branchMode
Optional. By default, branch mode is disabled. When a pipeline has multiple pipeline sources, only one code source can have branch mode enabled.
sources.<source_id>.branchMode.branchModelBranchFilter
Optional. This is a branch mode parameter. If branch mode is enabled for the code source and branchModelBranchFilter is configured, only branches that match the branchModelBranchFilter regular expression can run the pipeline.
sources.<source_id>.branchMode.keepIntegrationAreaBranch
Optional. This is a branch mode parameter. The value is a boolean, and the default is false. If set to true, the integration area is not cleared after branches are merged.
sources.<source_id>.branchMode.baseBranch
This is a branch mode parameter. If branch mode is enabled for the code source, you must specify the baseBranch. The baseBranch is the base branch from which release branches are pulled in branch mode. For example: The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
branchMode:
baseBranch: master
keepIntegrationAreaBranch: false
branchModelBranchFilter: feature/.*sources.<source_id>.certificate
This parameter is optional when sources.<source_id>.type is gitSample, git, or flowPipeline. It is required in other scenarios. This parameter sets the authorization information for cloning a code source or calling an external Jenkins service. If you use a service connection, set type to serviceConnection and enter the service connection ID. You can obtain the service connection ID from Service Connection Management in Enterprise Settings. For example:
sources:
my_repo:
type: codeup
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>Some code sources, such as generic Git and self-hosted GitLab, support cloning code using an enterprise public key. In this case, you can set type to sshKey. For example:
sources:
my_repo:
type: customGit
endpoint: https://<your_apsara_devops_instance_id>.devops.alibabacloudcs.com/codeup/abc/Codeup-Demo.git # The Apsara DevOps instance ID is a combination of 3 to 8 digits and letters.
branch: master
certificate:
type: sshKeysources.<source_id>.flowPipeline
This parameter is required when the pipeline source is a Flow pipeline. Enter the Flow pipeline ID, which is a 16-character random string. For example:
sources:
my_ci_pipeline:
type: flowPipeline
flowPipeline: atf******cmaofmk
......sources.<source_id>.build
This parameter is required when the pipeline source is a Jenkins source or a Flow pipeline. Enter the specific Jenkins task or Flow pipeline build number.
Triggering event | YAML identifier | Remarks |
Last successful run | lastSuccessfulBuild | Flow pipeline |
Specific run number | Build number | Flow pipeline |
For example:
sources:
my_jenkins:
type: jenkins
jenkinsJob: job-test
build: lastBuildsources.<source_id>.repoType
This parameter is required when the pipeline source is a Packages artifact source. `repoType` only supports the generic artifact type: `generic`.
sources:
my_repo:
type: packages
repoType: generic
repo: flow_generic_repo
artifact: Artifacts_1418394
version: 2024-03-28-11-53-39
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.repo
This parameter is required when the pipeline source is a Packages artifact source. Enter the specific repository ID. You can obtain the repository ID from the basic information of the repository on the packages.aliyun.com page.
sources:
my_repo:
type: packages
repoType: generic
repo: flow_generic_repo
artifact: Artifacts_1418394
version: 2024-03-28-11-53-39
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.artifact
This parameter is required when the pipeline source is a Packages artifact source. Enter the specific artifact name.
sources:
my_repo:
type: packages
repoType: generic
repo: flow_generic_repo
artifact: Artifacts_1418394
version: 2024-03-28-11-53-39
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
sources.<source_id>.version
This parameter is required when the pipeline source is a Packages artifact source. Enter the specific artifact version number.
sources:
my_repo:
type: packages
repoType: generic
repo: flow_generic_repo
artifact: Artifacts_1418394
version: 2024-03-28-11-53-39
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.region
This parameter is required when the pipeline source is an ACR image source. You can only enter a supported region.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.instance
This parameter is required when the pipeline source is an ACR image source. Enter the name of the authorized ACR Enterprise Edition instance under the current service connection.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.namespace
This parameter is required when the pipeline source is an ACR image source. Enter a namespace under the instance.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>
sources.<source_id>.imageRepo
This parameter is required when the pipeline source is an ACR image source. Enter the name of the image repository under the namespace.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.imageTag
This parameter is required when the pipeline source is an ACR image source. Enter a version name under the image repository.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>sources.<source_id>.versionFilter
Optional. Specifies the filter rule for the ACR image source versions that can run the pipeline. Enter a regular expression. Only versions that match the filter rule can trigger a pipeline run. This rule applies to all trigger types, including manual triggers, artifact source webhook triggers, scheduled triggers, and webhook triggers.
sources:
my_repo:
type: acr
region: cn-hangzhou
instance: yunxiao
namespace: default
imageRepo: test
imageTag: 2024-04-07-17-18-26-YAML
versionFilter: .*-YAML # Only versions that end with -YAML can run.
triggerEvents:
- pushCompleted
- scanCompleted
certificate:
type: serviceConnection
serviceConnection: <your-service-connection-id>