Pipeline sources define where a Flow pipeline fetches code, artifacts, or upstream pipeline outputs before a run begins.
Background information
Flow supports code sources, artifact sources, and Flow pipeline sources. You can configure multiple sources per pipeline.
-
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
Example of a single 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
Example of a multiple 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: repo1
Packages source example
Example of configuring an Apsara DevOps Packages generic artifact as a 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
Example of configuring an Alibaba Cloud ACR Enterprise Edition image as a 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
Example of configuring a Flow pipeline as a 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
You can configure multiple source entries. Each entry specifies a source type, address, and default branch.
defaultWorkspace
Required when the pipeline has multiple code sources. Pipeline tasks that do not specify a workspace run in the default workspace. Set the value to a <source_id>. For example:
sources:
repo1:
......
repo2:
......
defaultWorkspace: repo1
sources.<source_id>
Required. The pipeline source ID. At runtime, source files are downloaded to /root/workspace/<source_id>. ACR image sources are not downloaded. The value can contain only letters, digits, and underscores (_), must start with a letter, and cannot exceed 30 characters.
sources.<source_id>.type
Required. The pipeline source type. Valid values: 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
Required for code sources. The address of the code repository. 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.git
sources.<source_id>.branch
Optional. The default branch of the code source. Default value: master. This branch is used when the pipeline is triggered by a schedule or an external system. 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: master
Sample code sources only support the master branch.
sources.<source_id>.branchesFilter
Optional. A regular expression that filters which branches can run the pipeline. Only branches or tags that match the expression can trigger a 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. Specifies whether to clone submodules for code sources. Default value: 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: true
sources.<source_id>.cloneDepth
Optional. The number of recent commits to clone for code sources. Default: all commits. A smaller clone depth speeds up workspace preparation. Set to 0 to clone all commits. Valid values: integers 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: 10
sources.<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: theSecret
sources.<source_id>.triggerEvents
Optional. The source events that trigger the pipeline. By default, no events are configured. 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
- tagPush
sources.<source_id>.branchFilter (Deprecated)
This keyword is deprecated. Use sources.<source_id>.branchesFilter instead.
Optional. When code commit triggers are enabled for a code source, you can set branch filter conditions. By default, branches are not filtered. 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 code commit triggers are enabled for a code source, 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. 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. Enables branch mode. When a pipeline has multiple sources, only one code source can have branch mode enabled.
sources.<source_id>.branchMode.branchModelBranchFilter
Optional. A branch mode parameter. If branch mode is enabled and this parameter is configured, only branches that match the regular expression can run the pipeline.
sources.<source_id>.branchMode.keepIntegrationAreaBranch
Optional. A branch mode parameter. Boolean. Default value: false. If set to true, the integration area is not cleared after branches are merged.
sources.<source_id>.branchMode.baseBranch
A branch mode parameter. Required when branch mode is enabled. The baseBranch is the base branch from which release branches are created. 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
Optional when the source type is gitSample, git, or flowPipeline. Required for other types. Sets the authorization information for cloning a code source or calling an external Jenkins service. To use a service connection, set type to serviceConnection and specify the service connection ID. You can obtain the 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: sshKey
sources.<source_id>.flowPipeline
Required for Flow pipeline sources. The Flow pipeline ID, a 16-character alphanumeric string. For example:
sources:
my_ci_pipeline:
type: flowPipeline
flowPipeline: atf******cmaofmk
......
sources.<source_id>.build
Required for Jenkins sources and Flow pipeline sources. The build number of the Jenkins task or Flow pipeline run.
|
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
Required for Packages artifact sources. Only the generic artifact type (generic) is supported.
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
Required for Packages artifact sources. The repository ID. You can obtain it from the basic information page of the repository on packages.aliyun.com.
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
Required for Packages artifact sources. The 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
Required for Packages artifact sources. The 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
Required for ACR image sources. The region where the ACR instance resides.
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
Required for ACR image sources. 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
Required for ACR image sources. A namespace under the ACR 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
Required for ACR image sources. 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
Required for ACR image sources. The image tag (version) 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. A regular expression that filters which ACR image versions can run the pipeline. Only matching versions trigger a run. This rule applies to all trigger types, including manual, artifact source webhook, scheduled, 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>