创建管道
Blue Ocean makes it easy to create Pipelines in Jenkins. Pipelines can be created from existing `Jenkinsfile`s or from new `Jenkinsfile`s created with the Blue Ocean Pipeline Editor. The Pipeline Creation workflow guides users through this process in clear, easy to understand steps.
Starting Pipeline Creation
At the top of the Blue Ocean Dashboard, is a "New Pipeline" button that launch the Pipeline Creation workflow.
On new a Jenkins instance, where there are no jobs or Pipelines and the Dashboard is empty, Blue Ocean will also display a message box offering to "Create a New Pipeline".
Creating a Pipeline for a Git Repository
To create a Pipeline from a Git repository, start by selecting "Git" as the Source Control system.
Then enter the URL for the Git Repository and optionally select which credentials to use. If the dropdown down does not show the desired credentials, they can be added using the "Add" button.
When done, click "Create Pipeline". Blue ocean will look at all branches for the selected repository, and will start a Pipeline run for each branch containing a Jenkinsfile
.
Creating Pipelines for GitHub Repositories
To create a Pipeline from a GitHub, start by selecting "GitHub" as the Source Control system.
Provide a GitHub Access Token
If this is the first time Pipeline Creation has been run by the currently logged in user, Blue Ocean will ask for a GitHub Access Token to allow Blue Ocean to access your organizations and repositories.
If you have not already created a access token, click on the link provided and Blue Ocean will navigate to the right page on GitHub, automatically selecting the appropriate permissions it will need.
Select a GitHub Account or Organization
All repositories on Github are grouped by owner, either an account or organization. When creating Pipelines, Blue Ocean mirrors that structure, asking users to select an account or organization which owns the repositories from which it will add Pipelines.
From here, Blue Ocean offers two styles of Pipeline creation, either "single Pipeline" or "discover all Pipelines".
New Pipeline from a Single Repository
Selecting "New Pipeline" allows the user select and create a Pipeline for a single Repository.
After selecting a repository Blue Ocean will scan all the branches in that Repository and will create a Pipeline for each branch containing a "Jenkinsfile" in the root folder. Blue Ocean will then run the Pipeline created for each branch in this process.
If no branches in the selected repository have a "Jenkinsfile", Blue Ocean will offer to "Create a New Pipeline" for that repository, taking the user to the Blue Ocean Pipeline Editor to create a new Jenkinsfile
and add a new Pipeline based on that.
Auto-discover Pipelines
Selecting "Auto-discover Pipelines" scans all repositories belonging to the selected owner, and will create a Pipeline for each branch containing a "Jenkinsfile" in the root folder.
This option is useful for adding Pipelines for all the repositories in an organization, when those repositories already have Jenkinsfile
entries in them. Repositories that do not contain Jenkinsfile
entries are ignored. To create a new Jenkinsfile
in a single repository that does not have one, use the "New Pipeline" option instead.