Achieving Internal Continuous Integration with Jenkins
Table of Contents
- Configuring the Project Build
- Adding a Task
- Adding the Source Address and Login Credentials
- Adding Triggers to Build
- TFS Add WebHook
- Added Construction Steps
- Rear End the UI
- The API End
Configuring the Project Build
To achieve internal continuous integration, we will utilize Jenkins to automate the build process. This involves configuring the project build, adding tasks, and integrating with the Team Foundation Server (TFS).
1. Add a Task
The first step in configuring the project build is to add a task. This task will serve as the foundation for our build process. To add a task, follow these steps:
- Click on the “Add a task” button in the Jenkins dashboard.
- Select the type of task you want to add, such as a shell script or a Windows batch command.
- Enter the necessary details, such as the task name and description.
2. Add the Source Address and Login Credentials
The next step is to add the source address and login credentials. This will allow Jenkins to access the source code repository and authenticate with the TFS server.
- Click on the “Add the source address and login credentials” button.
- Enter the source address, which is the URL of the source code repository.
- Enter the login credentials, which include the username and password for the TFS server.
Error Displayed When Figure Did Not Fill Out the Voucher
If the figure did not fill out the voucher, an error message will be displayed. To resolve this issue, click on the back of the credential access to source code and enter the username and password.
Select the User Name and Password
Select the user name and password that you just added. This will authenticate the Jenkins build process with the TFS server.
Not Being Given Proper Representation to Fill
If the branches to build cannot be filled, it is recommended to fill in the corresponding branch that needs to be published.
3. Add Triggers to Build
The next step is to add triggers to build. This will allow Jenkins to automatically trigger a build when changes are made to the source code repository.
- Click on the “Add triggers to build” button.
- Select the type of trigger, such as a push code to the remote version of the TFS warehouse.
- Note: If the “Building Triggers” option does not exist, please install the Jenkins Plugin Manager Team Foundation Server Plug-in.
4. TFS Add WebHook
The final step is to add a WebHook to the TFS server. This will allow Jenkins to receive notifications when changes are made to the source code repository.
- Click on the “TFS add WebHook” button.
- Open the selected item and set it to select the right TFS service linked.
- Create a subscription => Jenkins => Next.
- Select the type of trigger event, such as “Push Code”.
- Filter the repository and select the corresponding branch to be pushed.
- Fill in the authentication username and password to access Jenkins.
- Select the level of integration, such as “Jenkins of TFS plug-in”.
- Click the Test button: The configuration shown success.
5. The Step of Adding Construction
The final step is to add the construction steps. This will allow Jenkins to deploy the application to the production environment.
- Click on the “Rear End the UI” button.
- Run the following command in the PowerShell window:
npm install - Run the following command in the PowerShell window:
npm run deploy-dev - Note: If this window PowerShell does not exist, please install the Jenkins Plugin Manager PowerShell.
- The deploy-dev command will see the back-end UI code file package.json.
- The build step will dotnet restore.
- The build step will dotnet publish.
The API End
The final step is to add the API end. This will allow Jenkins to deploy the application to the production environment.
- Click on the “API End” button.
- Run the following command in the PowerShell window:
dotnet restore - Run the following command in the PowerShell window:
dotnet publish - The build step will publish the application to the production environment.
Conclusion
In this article, we have demonstrated how to achieve internal continuous integration with Jenkins. We have configured the project build, added tasks, and integrated with the TFS server. We have also added triggers to build and added a WebHook to the TFS server. Finally, we have added the construction steps and API end to deploy the application to the production environment.