Introduction
This article is recommended only for readers who already understand version control.
The communication between Gerrit and Jenkins is usually achieved through Gerrit’s triggers and Jenkins’ plugins, automating the code review and build process. This integration can significantly enhance the efficiency and automation of the software development workflow.
It is highly recommended to use this flowchart alongside the following tutorial:
Basic steps of communication between Gerrit and Jenkins
1. Uploading code to Gerrit
Developer Submission: As a developer, when you complete code changes, these changes are pushed to a specific branch or Change Request in Gerrit.
Creating Review: Once Gerrit receives these changes, it creates a new code review instance for them.
2. Gerrit triggers Jenkins
Gerrit Trigger: Configured within Jenkins, the Gerrit Trigger plugin listens for events from Gerrit. When new changes are uploaded to Gerrit, the Gerrit Trigger plugin triggers Jenkins for a new build based on configured rules (for example, for all new submissions or submissions to specific branches).
3. Jenkins conducts build and tests
Automated Build/Test: Jenkins starts a build process based on the received trigger event, which may include compiling code, running automated tests, and performing static code analysis.
Feedback Results: After the build is completed, Jenkins reports the build and test results back to Gerrit. Typically, this is done by posting comments and/or +1 or -1 scores in the corresponding Gerrit code review.
4. Code Review
Manual Review: In addition to automated tests, the code also undergoes a manual review. Developers and reviewers assess the code changes based on the build and test feedback provided by Jenkins, as well as their own code review.
Approval and Merge: When the code changes pass the automated tests and receive approval from reviewers, they can be merged into the main branch.