Create pipeline based on Jenkinsfile¶
Workbench Pipelines supports creating pipelines using a Jenkinsfile in a repository.
Prerequisites
- Create Workspace, Create User.
- Add the user to the workspace with
workspace editor
or higher privileges. - Provide a code warehouse, and the source code of the code warehouse has a Jenkinsfile text file.
- If it is a private warehouse, you need to create warehouse access credentials in advance.
The specific operation steps are as follows:
-
Click
Create Pipeline
on the pipeline list page. -
Select
Create a pipeline based on the Jenkinsfile of the code base
and clickOK
. -
Fill in the basic information and code warehouse information by referring to the instructions below.
- name: the name of the pipeline. The pipeline name must be unique under the same workspace.
- Code warehouse address: fill in the address of the remote code warehouse.
- Credentials: For private repositories, you need to Create Repository Access Credentials in advance and select the credential here.
- Branch: Based on the code of which branch to build the pipeline, the default is the master branch.
-
Script path: the absolute path of the Jenkinsfile in the code repository.
-
Fill in the build settings and build parameters with reference to the instructions below.
-
Delete expired pipeline records: Delete previous build records to save disk space used by Jenkins.
- Build record retention period: Up to several days of build records are kept, the default value is 7 days, that is, build records older than seven days will be deleted. -Maximum number of build records: keep a maximum number of build records, the default value is 10, that is, keep a maximum of 10 records. When there are more than 10 records, the oldest records are deleted first.
- The two rules
retention period
andmaximum number
are in effect at the same time, as long as one of them is met, the records will be deleted.
-
Do not allow concurrent builds: When enabled, only one pipeline build task can be executed at a time.
- Build Parameters: Pass in one or more build parameters when starting to run the pipeline. Five parameter types are provided by default:
Boolean
,string
,multiline text
,options
,password
,upload file
. -
After adding build parameters, you need to enter the corresponding value for each build parameter when running the pipeline.
-
-
Fill in the build trigger by referring to the instructions below.
- Code source trigger: After it is turned on, the system will periodically scan the specific branch in the warehouse code used to build the pipeline according to the
timed warehouse scan plan
, and re-run the pipeline if there is an update. - Scheduled warehouse scan schedule: Enter a CRON expression to define the time period for scanning warehouses. After entering the expression, the meaning of the current expression will be prompted at the bottom. For detailed expression syntax rules, please refer to Cron Schedule Syntax.
-
Timing trigger: Timing triggers the construction pipeline, no matter whether the code warehouse is updated or not, the pipeline will be re-run at the specified time.
- Code source trigger: After it is turned on, the system will periodically scan the specific branch in the warehouse code used to build the pipeline according to the
-
Complete the creation. After confirming that all parameters have been entered, click the
OK
button to complete the creation of the custom pipeline and automatically return to the pipeline list. Click︙
to the right of the list to perform various actions.