Configure CloudBees Validated Merge plugin on DEV@cloud
- CloudBees Validated Merge plugin
=== CloudBees Git Validated Merge plugin
For customers developing software using Git version control, CloudBees offers a Jenkins plugin which can be used to ensure that proposed changes are buildable and pass all tests before being accepted into the team’s repository. This is variously known as “validated merge” or “pretested commit”, and is distinct from features which allow Jenkins to comment on code reviews in that no human approval is involved in the workflow: if the commits pass automated tests, they are pushed to “trunk” right away.
Installed and check whether you have the CloudBees Git Validated Merge Plugin in version 3.12 or later. If you have an older version, use the
Updates tab to upgrade it (and restart Jenkins); if you do not have it installed at all, use the
Available tab to get it.
Now go to
Configure System and under Git Validated Merge make sure
Prefer HTTP URLs is checked, and
Defining push credentials
Since Jenkins will need to push to your Git repository if the build is successful and all tests pass, it needs to be told how to authenticate to that repository. Go to
Manage Credentials and click
Add Credentials to create a new set of credentials suitable for pushing to Git. Both SSH private keys and HTTP(S) username/password pairs are supported.
If using a SSH private key, beware that the username is generally
git. Either kind of authentication may be used for DEV@cloud’s Forge repositories.
The above instructions assume that there is a single dedicated Git account that anyone in your team can use. If you prefer to have developers each use their own Git account for the push, they will need to go their user page (available from People but more easily by jumping to https://ACCOUNT.ci.cloudbees.com/me/configure), click
Add Credentials from there - if using ssh
git needs to be the username.
If your user has other credentials, to disambiguate the one used for Git push you should:
- At job level, ensure that
Enable Git validated merge supportis enabled and
Credentialsis set-up with
<automatic by pushing user>.
- Create the credentials at user level under https://ACCOUNT.ci.cloudbees.com/me/configure
Hostnamegiving your Git repository server’s DNS name in
Include, and then
Add Credentialsinside that.
Configuring a job
Let us assume you already have a Jenkins job building the master branch of your Git repository. Click
Configure on the job’s page, check
Enable Git validated merge support. Then click
Advanced and for Credentials specify the credentials you created in the step before - with
git as user in case you are using ssh, or
<automatic by pushing user> if you want to pick up per-user credentials. In this last case, you will need then to create the credentials at user level under https://ACCOUNT.ci.cloudbees.com/me/configure.
If you have automated tests, make sure the job is configured to report them. In other words, if there is a problem with a commit, the build status should be yellow (“unstable") or red (“failed”); blue means “success” to Jenkins.
Git Repository for Validated Merge link and follow the instructions given there for adding a special “remote” to your local clone of the Git repository and pushing proposed commits to it.