1. Introduction
First, BitBucket provides web hosting services that support mercurial and GIT version control systems. In short, it is similar to GitHub, except that it allows individuals to create private project warehouses for free. In addition to this, BitBucket provides pipeline capabilities to help us automate the construction, testing, and deployment of our projects.
2. User Guide
The project is a template project for the. Net core version created using the ABP, with the following project structure:
Click Pipeline, we select. NET Core to create a configuration file for configuring pipeline bitbucket-pipelines.yml
.
As you can see, the configuration is simple and consists of the following parts:
- Image: It's certainly not strange to know about Docker, by specifying an image to tell pipeline what image to pull for project compilation.
- Export: Specify the project name and test project name that we want to compile through export. (Note: You need to use a relative path.)
- Dotnet:.net Core's restore, compile, and test commands.
Because our project is based on. NET Core 2.0, and the layered schema is as follows:
We want to bitbucket-pipelines.yml
make the following changes:
Modify completed, click on the commit file immediately into the pipeline run interface, running results are as follows:
At this point, we've completed building and testing the. NET core project. So how do you get it to do these two things automatically? Simply, go back to the pipeline interface and click on the "Schedules" menu to create a "Schedule".
How do you complete the deployment?
Because I'm using micosoft Azure for deployment, so according to the official document deploy to Microsoft Azure, we just need to bitbucket-pipelines.yml
add a git push
command later, as follows:
- git push https://$AZURE_LOGIN:[email protected]/Abpeshop.git master
where $AZURE_LOGIN
and $AZURE_PASSWORD
is the deployment credential for Azure, we need to define environment variables in our current project warehouse, as shown in:
There is no truth in the last Picture:
3. Finally
BitBucket offers a free build time of pipeline for 50mins/months, but it is enough for our simple early adopters! Of course, if not enough, its pay strategy is also very favorable, 2$/month, with 500mins/months of construction time.
Of course, Microsoft's VSTS is also a good choice.
Reference article:
. NET Core 2.0 Continuous integration, continuous publishing environment
Building NuGet (. NET Core) Using Atlassian bitbucket Pipelines
Building. NET Core Apps with BitBucket pipelines and Docker
Automated build, test, and deployment of. Net core projects using BitBucket pipeline