⚠️ WARNING⚠️ This plugin is deprecated. Its functionality has been integrated into the Plastic SCM plugin. Please update your projects to use the Plastic SCM plugin instead.
Enable DevOps automation features in Jenkins using Plastic SCM's mergebot.
First of all, create a new freestyle project and select Mergebot Plastic SCM as the Source Code Management option:
The plugin itself doesn't need any specific configuration. All settings and parameters are set through Plastic SCM WebAdmin when you configure your mergebot.
If you wish to use the pipeline workflow for the Jenkins parts of your DevOps cycle, you typically have two options: defining a Pipeline script directly in the plan configuration or retrieving it from SCM every build.
Regardless of what option you choose, remember to put the mergebotCheckout()
command in your
Groovy script when you wish to checkout sources from Plastic SCM.
This is an example of a pipeline script using the mergebot checkout:
node {
def mvnHome
stage('Preparation') { // for display purposes
// Get code from Plastic SCM as specified in the build parameters
mergebotCheckout()
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'M3'
}
stage('Build') {
// Run the maven build
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archive 'target/*.jar'
}
}
You can also choose to retrieve the script from the Plastic SCM changeset to build. Select "Pipeline script from SCM" as the Definition value in the Pipeline section. Then, choose "Mergebot Plastic SCM" as the SCM value. You can also specify the file path to find the Jenkinsfile. If you enable the Lightweight checkout, the plugin will only retrieve that file. Otherwise, the plugin will perform a complete checkout of the target changeset to load it.
To allow Plastic SCM to trigger builds in your Jenkins plan, be sure to check the option "Trigger builds remotely" in the "Build triggers" section of the plan configuration.
You can configure the Jenkins plug parameters from the WebAdmin. First, create a new Jenkins plug configuration:
Then, select that new configuration as the CI plug of a mergebot configuration:
At this point, the mergebot will automatically trigger Jenkins builds. You don't need to worry about this anymore!
These are the build parameters set by TrunkBot when it triggers a build. They're injected as environment variables so the build steps can use them in their processes.
Please bear in mind that only the PLASTICSCM_MERGEBOT_UPDATE_SPEC
value is mandatory. The rest
depend on the particular implementation of the mergebot. If you're using a custom mergebot you can
define your own build parameters.
We'll refer to the changeset being built in a given build as the "current changeset".
PLASTICSCM_MERGEBOT_UPDATE_SPEC
: the target object to checkout. It can be a shelve spec, a branch spec, a label spec or a changeset spec.- The
plasticscm-mergebot-plugin
requires this build parameter.
- The
PLASTICSCM_MERGEBOT_BRANCH_HEAD_CHANGESET_AUTHOR
: the name of the user who created the current changeset.PLASTICSCM_MERGEBOT_BRANCH_HEAD_CHANGESET_NUMBER
: the number (also known as ChangesetID) of the current changeset.PLASTICSCM_MERGEBOT_BRANCH_HEAD_CHANGESET_GUID
: the GUID of the current changeset.PLASTICSCM_MERGEBOT_BRANCH_NAME
: the branch name of the current changeset.PLASTICSCM_MERGEBOT_TRUNK_HEAD_CHANGESET_NUMBER
: the target changeset number to merge the current changeset if the build is successful.PLASTICSCM_MERGEBOT_TRUNK_HEAD_CHANGESET_GUID
: the target changeset GUID to merge the current changeset if the build is successful.PLASTICSCM_MERGEBOT_REPSPEC
: the repository where the current changeset is stored.PLASTICSCM_MERGEBOT_TASK_NUMBER
: the issue identifier related to the branch of the current changeset.
- Jenkins
2.7.3
or newer - Plastic SCM command line client
7.0.16.2630
or newer- The CLI needs to be configured for the Jenkins user in the master and agent machines.
To build the plugin you will need:
- Maven version
3.5
or newer - Java Development Kit (JDK) version
7
Run the following command to build the plugin:
mvn package
New feature requests and bug fix proposals should be submitted as
pull requests.
Fork the repository. Make the desired changes in your forked copy. Submit a pull request to the
master
branch.
Use the Jenkins SCM API coding style guide for new code.
Before submitting a pull request please check if your code passes code quality and style checks by running:
mvn verify
All pull requests will be evaluated by Jenkins CI.
This plugin is developed and maintained by Codice Software S.L., owner of the Plastic SCM product.
Visit us at https://www.plasticscm.com
You can meet the team here!
We really appreciate PR and contributions!
Feel the power of merging branches easier than ever with SemanticMerge!
You can find it here