Jenkins : AccuRev Plugin

This plugin allows you to use AccuRev as a SCM.

Plugin Information

View AccuRev on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

This plugin is up for adoption. Want to help improve this plugin? Click here to learn more!

Terms of Use

By downloading this, you agree that the AccuRev plugins are subjected to the terms and conditions of the applicable EULA for your AccuRev license.

Installing the AccuRev Plug-In for Jenkins

If this is the first time you have installed the AccuRev Plug-In for Jenkins, use the following procedure. (If you have installed this plugin before, go to the “Upgrading the AccuRev Plug-In for Jenkins” section below.)

To install the AccuRev Plug-In for Jenkins:

  1. Select Manage Jenkins from the main menu, then select Manage Plugins from the options presented:
  2. On the Jenkins Plugin Manager page, select the Available tab, select the AccuRev Plugin, and click the Install without restart button.

Upgrading the AccuRev Plug-In for Jenkins

If you have previously installed the AccuRev Plug-In for Jenkins, take the following steps to upgrade to a newer version:

  1. In Jenkins, select Manage Jenkins from the main menu, then select Manage Plugins from the options presented.
  2. On the Plugin Manager page, select the Updates tab, select the AccuRev Plugin, and click the Download now and install after restart button.

Configuring the AccuRev Plug-In for Jenkins

After installing the AccuRev Plug-In for Jenkins, configure the AccuRev Server settings as described in the following section.

Configuring the AccuRev Server Settings

To configure the AccuRev server settings:

  1. Select Manage Jenkins from the main menu, then select Configure System from the options presented:
  2. Scroll down to the AccuRev section of the configuration page:
  3. Fill in each of the settings:
    • Name – a descriptive name for this entry. When you configure a new build, this name appears in the server drop-down for AccuRev.
    • Host – the host/IP of the AccuRev server. If you're not sure what this is, you can select Info from the Tools menu to view this information.
    • Username – your AccuRev user ID.
    • Password – the password for your AccuRev user ID.
    • Port – port of the AccuRev server connection. By default, the port number is 5050.
    • Poll on master – if AccuRev client on the master should be used for polling for changes
  4. If you want to add the settings for another AccuRev server , click Add. To delete the settings for an AccuRev server, click Delete.
  5. To save your changes, scroll to the bottom of the configuration page and click Save.

Configuring a build to use AccuRev

Once you have configured the AccuRev server settings, new builds can choose it for pulling down code. Create a new build, give it a job name, select the type of build, and click OK. On the subsequent screen, you'll see a section called Source Code Management where you can select AccuRev.

  1. Select AccuRev as your source code management system and the following options appear:

    You should see the server entry you created in the Server drop-down, and it is likely selected by default. Select it if it is not. Then enter in the names of the Depot and Stream you wish to build.
  2. Optionally, you can click the Advanced button to specify additional AccuRev options.

    In the Advanced Options section, select any of the following features:
    • Use Workspace – Determines whether or not an AccuRev workspace should be used for checkout. When you select this option, the Workspace text field appears. Enter the name of an existing workspace in the Workspace field. The plugin can manage migrating the workspace to the appropriate build machine and re-parenting the workspace to use the correct parent stream (Jenkins considers the Stream field value as the parent stream). If you use an AccuRev workspace, it should be dedicated to a particular Jenkins job to avoid problems that can arise when multiple jobs trying to retarget the workspace at the same time for builds. Note that workspace changes are logged as AccuRev transactions.
    • Use Reference Tree – Determines whether or not an AccuRev workspace should be used for checkout. An AccuRev  reference tree can be thought of as a read-only portal to the AccuRev data repository. There may be situations when the use of an AccuRev reference tree is desired, such as when you want to use the latest versions of files that you do not intend to modify.  When you select this option, the Reference Tree text field appears. Enter the name of the reference tree in the Reference Tree field. AccuRev Plug-in for Jenkins manages the process of migrating the reference tree to the appropriate build machine and relocating the reference tree to use the correct location. Note that these changes are logged as AccuRev transactions.
    • Neither – When you select this option, Jenkins checks out the latest changes without using an AccuRev workspace or reference tree.
    • Directory Offset – The relative directory path from the default Jenkins workspace location where the files from the stream, workspace, or reftree should be retrieved from. Leave this field blank if you want to continue using the Jenkins default workspace location.
    • Sub-path – Some projects only use a portion of the stream, workspace, or reference tree and, in these instances, it is not necessary to check out the entire contents of the repository, such as when you are accessing, for example, a large remote repository to build a sub-module. In such cases, it may be useful to set up a sub-path. Directories and files must be specified in the Sub-path text field as a comma-separated list and can use relative pathnames. For example, you could use: _src/com/my-company/main/my-file.java,src/com/test,src/com/webapp/my-file2.xml _where "src" is the immediate sub-folder under your stream, workspace, or reference tree.
    • Filter for Poll SCM – If the Poll SCM check box under the Build Triggers section is selected, you can use the Filter for Poll SCM field to specify the directories or files you want Jenkins to check before starting a build. Any changes made to the files or directories that you specify in the Filter for Poll SCM field will trigger a build in Jenkins. Directories and files must be specified in a comma-separated list and can use relative pathnames. NOTE: If you select Poll SCM in the Build Triggers section of the Jenkins configuration page, but you do not specify any Filter for Poll SCM files or directories, then any files or directories you have specified in the Sub-path field are used as the filter for polling. In this case, changes made to elements in the sub-path will trigger a build in Jenkins.
    • Create and build from snapshot – When you select this option, AccuRev Plug-In for Jenkins creates a snapshot of the target stream, then populates and builds from that snapshot. NOTE: If the snapshot name already exists, the process fails and the build stops.

Setting the color of stream indicators based on build results

You can set the color of the AccuRev stream indicator in Jenkins to show whether that build failed or succeeded by using the -r option <name><value> for the setproperty command, which is available in AccuRev version 6 and later. To add these commands, you must use plugins which conditionally allow you to execute these as shell script / batch commands as in the following examples.

To set the color of stream indicator as green if the build succeeds or red if it fails:

  1. Set the following conditions in the Jenkins Conditional BuildStep Plugin page ( https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin ):
  2. Using the Jenkins PostBuildScript plugin, set the following conditions:

    Note that in AccuRev 6.1.x, the property name is "streamStyle" while the property name in AccuRev 6.0.x is "style". If you are using AccuRev 6.0.x, replace "streamStyle" in the above examples with "style".

Setup Post Promote Listener

You need to add some perl script and a server post promote trigger for plugin to ensure that "Enable Post Promote Listener" is getting notification.
This gist contains the needed perl script, see the comment

https://gist.github.com/casz/12f983751791644294806696d8269a24#gistcomment-1989618

Ensure you have enabled Post Promote Listener under advanced for each server, that needs the post promote listener.

Known issues.

  • JENKINS-38201 - AccuRev relies heavily on hostname especially when using work spaces, this can be troublesome on unix.

Version History

Moved to GitHub Releases

Version 0.7.20 (06/14/2019) - Micro Focus Contributed

  • Job "Changes" do not match "Filter for Poll SCM".

Version 0.7.18 (09/07/2018) - Micro Focus Contributed

  • Misspelling and capitalization of product name AccuRev is fixed now.
  • Jenkins console logs no more displays "No AccuRev tool is chosen" in console logs if AccuRev path is rightly configured. Also, if plugin is using AccuRev command from PATH environment variable
  • If default AccuRev profile was used, console logs displays “No AccuRev tool is chosen, reverting to AccuRev”, only once, reducing the noise.
  • Jenkins job fails if AccuRev command fails.

Version 0.7.17 (07/30/2018)

Version 0.7.16 (05/15/2018) - Micro Focus Contributed

  • It is now possible to enable / disable the AccuRev plugin from interacting with the AccuRev server. This is useful when the AccuRev stream hierarchy is being reworked and you don’t want Jenkins building while this activity is underway.
  • Fixed problem with Jenkins reporting "No port number specified for connecting to server" error, when using AccuRev 7.1 or higher.
  • Jenkins now correctly works with the "Filter for Poll SCM" option.
  • Jenkins user can now validate the connection of configured AccuRev server , using "Test Connection" option.

Version 0.7.14 (06/12/2017)

  • JENKINS-44748 - Accurev populate fails if latest transaction contains defunct files Resolved

Version 0.7.13 (04/19/2017)

  • JENKINS-43457 - Added a check for empty jenkins workspace when deciding to do an optimized populate for only recent transactions changes
  • JENKINS-43657 - When checking out accurev workspace, the wrong stream was chosen for determining the optimized populate.

Version 0.7.12 (04/06/2017) - Micro Focus Contributed

  • Jenkins currently prints full AccuRev username and password when authorization fails. Now, only UserID is being logged, not the Password.
  • AccuWork history appears in Jenkins change log.
  • AccuRev Jenkins Plugin Polling Issue when Sub-path used.
  • AccuRev Plugin Polling.
  • Jenkins Jobs can now be triggered off an AccuRev 6.2 Gated Streams.
  • Jenkins Plugin to take action\wake up on demote and purge.
  • Enhancements to AccuRev Jenkins Plugin.

Version 0.7.11 (02/28/2017)

  • Fixed job config in advanced settings not being configurable.

Version 0.7.10 (02/28/2017)

  • JENKINS-41215 - Credentials Implemented. (You cannot easily downgrade after updating. If you decide to downgrade please ensure username and password is set on global settings)
  • JENKINS-41233 - Support generic SCM checkout (Pipeline), required parameters are ServerUUID, Depot, Stream while the rest is optional.
  • JENKINS-41526 - Filter on wildcard, so src/*/java/* or *.java works. 
  • JENKINS-2696 - Added Accurev Tool so you can now choose where Accurev executable is located.
  • Minor fixes to depot/stream selection.

Version 0.7.9 (01/21/2017)

  • JENKINS-41266 - Fixed regression of FindAccurevExe introduced in 0.7.7.

Version 0.7.8 (01/19/2017)

  • JENKINS-41165 - Fixed regression of Ignore Parent introduced in 0.7.7 - Updated error messages too.

Version 0.7.7 (01/16/2017)

  • Added new Build Trigger that listens for Promote events through Mosquitto.
    Implemented with Accurev's Post Promote Trigger with Perl script. I'll add link to the required documentation/script (Github)
  • JENKINS-41018 - Refactored CheckForChanges and sanitise filter 

Version 0.7.6 (10/25/2016)

  • JENKINS-39211 - Fixed getServer when serverUUID was null, try name instead. Set UUID if null.

Version 0.7.5 (10/19/2016)

Version 0.7.4 (10/18/2016)

  • JENKINS-39038 - Fixed empty password on Windows.
  • Fixed regression in ParseGetConfig when file does not exist.

Version 0.7.3 (10/13/2016)

  • JENKINS-38702 - Fixed ACCUREV_HOME to Node's root directory in PR 32
  • JENKINS-31316 - Fixed Server rename
  • PR 30 - XML parser handles encoding
  • PR 32 - Refactored to use only AccurevLauncher, Masking password done simply.
  • Build should fail when unable to login or get stream(s).
  • Updated parent POM to 2.17

Version 0.7.2 (9/28/2016)

  • JENKINS-28118 - Fixed poll on ancestor
  • JENKINS-10937 - Improved logic for Workspace
  • JENKINS-24710 - filter out dispatch transactions
  • JENKINS-13817 - Mask the damn password already
  • JENKINS-31316 - Fixed server rename
  • Fixed Change log on Ignore Parent
  • Fixed getStreamRules to behave as intended.
  • Allow empty password even with OBF
  • PR #24 fix PollOnMaster enabled when build using workspace

Version 0.7.1 (9/15/2016)

Version 0.7.1 (9/15/2016)

Version 0.7.0 (8/28/2016)

  • JENKINS-12913 - Removed Log, don't know the history but it cannot be that useful.
  • JENKINS-30336 - Added /Applications/AccuRev as a search location.
  • JENKINS-4369 - No more false positive on workspace relocation.
  • accurev-plugin PR #24 - Skip a poll that requires a workspace when the build is busy.
  • Plugin now using 2.13 of the parent plugin.
  • Code cleanup, targeting Java 1.8 (thumbs up)

Version 0.6.28 (8/18/2014)

  • Added ability to set the color on a stream indicator based on the build result. See the section above titled, "Setting the color of stream indicators based on build results", for more information.
  • If the ACCUREV_HOME environmental variable is set, that value is added to the build environment variables
  • If the ACCUREV_BIN environmental variable is set, the AccuRev Plug-In searches for binaries in that location. If ACCUREV_BIN is not set, the AccuRev Plug-In searches the following default directory paths:
  • On Windows:
    • C:\Program Files\AccuRev\bin
    • C:\Program Files (x86)\AccuRev\bin
    • C:\opt\accurev\bin
  • On UNIX and Linux:
    • /usr/local/bin/accurev
    • /usr/bin/accurev
    • /bin/accurev
    • /local/bin/accurev
    • /opt/accurev/bin/accurev

Version 0.6.23 (3/28/2014)

  • Workspace usage restored (JENKINS-21496)
  • Changelog support for the Jenkins extended e-mail plugin
  • Transactions and issues rendered as hyperlinks in the changelog

Version 0.6.18 (8/19/2011)

  • have the option to enter multiple sub-paths (comma-separated) into the sub-path text field in the job settings. JENKINS-10538

Version 0.6.17 (8/19/2011)

  • JENKINS-10638
  • Enhancement: JENKINS-10637
  • JENKINS-10719, including
    • New feature: Ignore parent stream - can now tell a project to ignore changes made in the basis stream of the actual stream being built. This can signficantly reduce the time the plugin takes talking to the accurev server.
    • New feature: Get streams singly - more of an accurev client workaround really; the plugin used to call the server and get "the streams" which included absolutely everything under the sun, and this turns into many megabytes of data, every poll and every build. This server setting says to get just the streams we care about (our stream, our parent stream etc), albeit at the cost of potentially making more than one call to the server.
    • Enhancement: Logging improved, which should make debugging accurev client failures a little easier.

Version 0.6.16 (7/12/2011)

  • AccuRev stream name can be pre-set by Job String Parameter (JENKINS-10073)
    • make string parameter in job e.g. acstream
    • then set in stream name field:

      ${acstream}
    • SCM polling will go against the default value of the string parameter

Version 0.6.15 (5/19/2011)

  • GitHub changes since v0.6.13: GitHub Change Log
  • Made Snapshot names configurable (JENKINS-8039)
  • AccuRev Logging Enhancements, and fixed NPE during change polling (JENKINS-9601)
  • AccuRev login handling enhancements and change stream logging enhancements (JENKINS-9629)
  • Avoid login command if no username or server specified and use more accurate dates during populate (JENKINS-8935)
  • Don't trigger a new build when changes are detected if a build is already queued (JENKINS-9124)

Version 0.6.13 (3/15/2011)

  • Added option to purge overlaps when using a workspace.
  • Added option to make purge workspace optional when the previous build fails.
  • merged changes for snapshotting builds back into the current trunk (JENKINS-5196)

Version 0.6.11 (2/3/2010)

  • Plugin now using 1.345 of the parent plugin.
  • Added global option to turn off synchronization across AccuRev operations (JENKINS-4722).
  • Added global option to specify what transaction types trigger a build (JENKINS-3967).
  • Exposed environment variables to the build (JENKINS-3222):
    • ACCUREV_DEPOT
    • ACCUREV_STREAM
    • ACCUREV_SERVER
    • ACCUREV_WORKSPACE
    • ACCUREV_SUBPATH
    • ACCUREV_LAST_TRANSACTION

Version 0.6.8 (20/7/2009)

  • Plugin maintainer changed (now statlor). Activity on this plugin should pick up.
  • Fix for issue 3006 which was partially fixed in 0.6.7 but was still causing problems for many. The purpose of this version was to get a more stable release version out there, then work on more bug fixes and enhancements in subsequent releases.

Version 0.6.6 (31/3/2008)

  • Added the ability update (without purging the workspace) when using a workspace and the previous build is not broken.

Version 0.6.1 (13/12/2007)

  • Added the ability to synchronize the build server clock with the accurev server's clock.

Version 0.6 (13/12/2007)

  • Fixed some NPE's in edge cases
  • Added some help files
  • Added the ability to only populate a subset of the workspace (useful when the workspace is large, at a remote site, and you are only interested in a portion of the repository)

Version 0.5 (12/12/2007)

  • minor bug fix on global settings page whereby server ports were "forgotten"
  • removed workaround for masking passwords when authenticating to the
    accurev server
  • Known issues: Change log does not include changes in parent streams when changes
    in the stream and it's parent overlap.

Version 0.4 (3/12/2007)

  • Build triggers now reflect changes in parent streams where appropriate.
  • Now supports checkout using a workspace (I still recommend not using this option, it's there for people who _must_ use it)
  • Known issues: Change log does not include changes in parent streams when changes
    in the stream and it's parent overlap.

Version 0.2 (11/10/2007)

  • On linux, stream names were being quoted.  Now all names are unquoted. This may give rise to issues when running on windows with stream names that contain spaces.  If that's the case, will have to play dancing games figuring out the slave's operating system in order to add quotes for windows only!

Version 0.1 (11/10/2007)

  • Requires Accurev 4.5.x (I have only tested when x >= 1)
  • Currently does not support using check-out using a workspace (but why would you want that anyway)
  • Currently does not provide real time validation of inputs (i.e. depot names, stream names, username, password, etc)


Attachments:

accurev-hudson-1.png (image/png)
accurev-hudson-2.png (image/png)
accurev-hudson-3.png (image/png)
accurev-hudson-4.png (image/png)
wiki_manage.png (image/png)
wiki_configure.png (image/png)
wiki_server.png (image/png)
wiki_scm_options.png (image/png)
wiki_advanced.png (image/png)
wiki_success.png (image/png)
wiki_failure.png (image/png)
image2018-5-16 12:23:53.png (image/png)
image2018-5-16 12:29:8.png (image/png)