Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

No information for the plugin 'svn-release-mgr' is available. It may have been removed from distribution.

This plugin allows you to set up a job in Jenkins for building specific revisions of a project.
Be sure to select both "Use Subversion Release Manager" in the top section of the job configuration page, and select "Subversion Release" for the SCM type, rather than the standard Subversion SCM.

Here is a screenshot of this project configured to use the plugin.

Today it uses a copy of SubversionSCM named SubversionReleaseSCM, but would only require a small change to SubversionSCM.CheckOutTask to work with the core code.

Here is the change that is needed. Just look for the java comments that start with EDIT.

  1. Add a String field for the revision
  2. In the constructor, retrieve the revision number from the environment variable.
  3. Set the revision to check out based on the value stored in revision field if not null
    Here is a link to the patch request: JENKINS-3207
SubversionSCM.java CheckOutTask
    /**
     * Either run "svn co" or "svn up" equivalent.
     */
    private static class CheckOutTask implements FileCallable<List<External>> {
        private final ISVNAuthenticationProvider authProvider;
        private final Date timestamp;
        // true to "svn update", false to "svn checkout".
        private boolean update;
        private final TaskListener listener;
        private final ModuleLocation[] locations;
        //EDIT (1) next line added by piascikj for building specific revision
        private String revision;

        public CheckOutTask(AbstractBuild<?, ?> build, SubversionSCM parent, Date timestamp, boolean update, TaskListener listener) {
            this.authProvider = parent.getDescriptor().createAuthenticationProvider();
            this.timestamp = timestamp;
            this.update = update;
            this.listener = listener;
            this.locations = parent.getLocations(build);
            //EDIT (2) next line added by piascikj for building specific revision
            this.revision = build.getEnvVars().get("REVISION");
        }

        public List<External> invoke(File ws, VirtualChannel channel) throws IOException {
            final SVNClientManager manager = createSvnClientManager(authProvider);
            try {
                final SVNUpdateClient svnuc = manager.getUpdateClient();
                final List<External> externals = new ArrayList<External>(); // store discovered externals to here
                //EDIT next line removed by piascikj for building specific revision
                //final SVNRevision revision = SVNRevision.create(timestamp);
                //EDIT (3) next 6 lines added by piascikj for building specific revision
                SVNRevision revision = SVNRevision.create(timestamp);
                try {
                	if (this.revision != null) revision = SVNRevision.create(Long.parseLong(this.revision));
                } catch (NumberFormatException e) {
                	listener.getLogger().println("Unable to parse revision number from value: " + this.revision + ", checking out HEAD revision.");
                }
                if(update) {
                    for (final ModuleLocation l : locations) {
                        try {
                            listener.getLogger().println("Updating "+ l.remote);

                            File local = new File(ws, l.local);
                            svnuc.setEventHandler(new SubversionUpdateEventHandler(listener.getLogger(), externals,local,l.local));
                            svnuc.doUpdate(local.getCanonicalFile(), l.getRevision(revision), true);

                        } catch (final SVNException e) {
                            if(e.getErrorMessage().getErrorCode()== SVNErrorCode.WC_LOCKED) {
                                // work space locked. try fresh check out
                                listener.getLogger().println("Workspace appear to be locked, so getting a fresh workspace");
                                update = false;
                                return invoke(ws,channel);
                            }
                            if(e.getErrorMessage().getErrorCode()== SVNErrorCode.WC_OBSTRUCTED_UPDATE) {
                                // JENKINS-1882. If existence of local files cause an update to fail,
                                // revert to fresh check out
                                listener.getLogger().println(e.getMessage()); // show why this happened. Sometimes this is caused by having a build artifact in the repository.
                                listener.getLogger().println("Updated failed due to local files. Getting a fresh workspace");
                                update = false;
                                return invoke(ws,channel);
                            }

                            e.printStackTrace(listener.error("Failed to update "+l.remote));
                            // trouble-shooting probe for #591
                            if(e.getErrorMessage().getErrorCode()== SVNErrorCode.WC_NOT_LOCKED) {
                                listener.getLogger().println("Polled jobs are "+ Hudson.getInstance().getDescriptorByType(SCMTrigger.DescriptorImpl.class).getItemsBeingPolled());
                            }
                            return null;
                        }
                    }
                } else {
                    Util.deleteContentsRecursive(ws);

                    // buffer the output by a separate thread so that the update operation
                    // won't be blocked by the remoting of the data
                    PipedOutputStream pos = new PipedOutputStream();
                    StreamCopyThread sct = new StreamCopyThread("svn log copier", new PipedInputStream(pos), listener.getLogger());
                    sct.start();

                    for (final ModuleLocation l : locations) {
                        try {
                            listener.getLogger().println("Checking out "+l.remote);

                            File local = new File(ws, l.local);
                            svnuc.setEventHandler(new SubversionUpdateEventHandler(new PrintStream(pos), externals, local, l.local));
                            svnuc.doCheckout(l.getSVNURL(), local.getCanonicalFile(), SVNRevision.HEAD, l.getRevision(revision), true);
                        } catch (SVNException e) {
                            e.printStackTrace(listener.error("Failed to check out "+l.remote));
                            return null;
                        }
                    }

                    pos.close();
                    try {
						sct.join(); // wait for all data to be piped.
					} catch (InterruptedException e) {
                        throw new IOException2("interrupted",e);
                    }
                }

                try {
                    for (final ModuleLocation l : locations) {
                        SVNDirEntry dir = manager.createRepository(l.getSVNURL(),true).info("/",-1);
                        if(dir!=null) {// I don't think this can ever be null, but be defensive
                            if(dir.getDate()!=null && dir.getDate().after(new Date())) // see http://www.nabble.com/NullPointerException-in-SVN-Checkout-Update-td21609781.html that reported this being null.
                                listener.getLogger().println(Messages.SubversionSCM_ClockOutOfSync());
                        }
                    }
                } catch (SVNException e) {
                    LOGGER.log(Level.INFO,"Failed to estimate the remote time stamp",e);
                }

                return externals;
            } finally {
                manager.dispose();
            }
        }

        private static final long serialVersionUID = 1L;
    }

Change Log

Version 1.2 (2010-11-03)
  • Fix a couple help links
Version 1.1 (2010-03-01)
  • Thread safety fix for compare and build actions
  • Change maxRevisions field validation to client-side
  • Fix help link and add content
  • Misc cleanup and javadoc updates
  • Bump version up to 1.1 since there's a 1.0 out there even though 0.2 was the last release
Version 0.2 (2009-12-29)
  • Fix broken image
  • Update uses of deprecated APIs
Version 0.1 (2009-03-27)
  • Initial release

18 Comments

  1. Unknown User (jaybytez)

    Can you explain if this revision is the Subversion revision or is this related to a tag/branch in subversion?

    I installed this plugin and don't see the releases link.

    Is that because I need to make code changes suggested above?

    Thanks...jay

  2. Unknown User (john@therefromhere.org)

    Note that the example screenshot has a typo - "Prodution" should be "Production"

  3. Unknown User (krishna.pr@gmail.com)

    Hi

    I am supposed to build a svn revision using subversion release manager. I have configured a build parameter for the revision number. I would like to set a default value so that SVN head is built when the revision number is not specified/changed. 'HEAD' does not seem to be working. I see the following error:

    Location 'http://<mySVNLocation>/trunk@HEAD' does not exist.

    any workarounds? Thanks.

  4. Unknown User (salman__awan@hotmail.com)

    Hey Jesse, Great plug-in, worked a charm, thanks a lot as it resolved a pressing issue on my part.

    Just a question, when selecting 'Subversion Release' instead of 'Subversion' as SCM, two additional options that are available with 'Subversion' SCM are not available any more i.e. 'Use update' and 'Revert'.

    Is that by design, or you might consider adding them in future?

    Thanks again, Regards, Salman Awan

  5. Unknown User (robertredd)

    In addition to the issue mentioned by Salman above, I can also no longer browse or see the diff in files modified when looking at the project's change history using the Repository Browser option.  I use ViewSVN with the repository URL specified.  It worked when the SCM was the original Subversion type, though.

  6. Unknown User (fkeller)

    Hi,

    this is a nice and very usefull plugin, but i have one problem. I have a job with additional parameters for environments, this paramter is ignored from the plugin when building a release from the release overview. is there

    a way to use release manager and seperatly configured parameters?

    thx

  7. Unknown User (korpo)

    Hello, Jesse.

    I saw that you largely replaced Subversion SCM plugin for this and had some trouble because you use your classes instead of installed ones. I see you do this because you want to be able to use a specific revision upon checkout.

    Reading the trunk sources of the "subversion" SCM plugin I saw that you can now add a "RevisionParameterAction" that will override the Revision to be checked out in the CheckOutTask. This might make your fix obsolete. I'll try if I can get a version together that uses this mechanism - I just need a way to construct a SVNRevision object in the doBuild action and then I can add this parameter to the build to be scheduled in your doBuild() method.

    Cheers

    1. Unknown User (korpo)

      I tested it, it works fine with the RevisionParameterAction. I'm just fiddling with the doBuild() and the associated stapled form, but the code can work with the given SubversionSCM and the plugin is then very lean.

      Cheers

  8. Unknown User (korpo)

    Hello, Jesse.

    I have a finished version here that just uses the regular subversion plugin plus your few extra files and it works fine. How do I commit it back to you?

    Cheers

    1. Unknown User (wedamija@gmail.com)

      Hi Oliver

      Any word on the update?  If you're unable to update this plugin, any change of submitting an alternative?

      Regards,

      Dan

      1. Unknown User (korpo)

        Yes, maybe that's the way to go. I just hoped we could fix it here.

        We have my fix in use. It really makes it nice and clean, and the subversion maintenance is left to the subversion plugin.

        We find this plugin useful.

        Cheers,

        Oliver

  9. Unknown User (michael@infusedindustries.com)

    Oliver, I'd love to have your fix too. When install this version and try to run I get the following error. Any idea why this might be happening?At revision 2098
    hudson.util.IOException2: revision check failed on https://infusedindustries.springloops.com/source/infusedpalermo/trunk/esofthead/php
    at hudson.scm.SubversionReleaseChangeLogBuilder.buildModule(SubversionReleaseChangeLogBuilder.java:133)
    at hudson.scm.SubversionReleaseChangeLogBuilder.run(SubversionReleaseChangeLogBuilder.java:75)
    at hudson.scm.SubversionReleaseSCM.calcChangeLog(SubversionReleaseSCM.java:276)
    at hudson.scm.SubversionReleaseSCM.checkout(SubversionReleaseSCM.java:376)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1038)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
    at hudson.model.Run.run(Run.java:1257)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:129)
    Caused by: org.tmatesoft.svn.core.SVNException: svn: No such revision 2100
    svn: REPORT of '/source/infusedpalermo/!svn/bc/2099/trunk/esofthead/php': 500 Internal Server Error (https://infusedindustries.springloops.com)

    1. Unknown User (korpo)

      Hello, all.

      Please help me out.

      I could provide a version that uses the subversion plugin for Hudson, so that the normal subversion plugin can be used again as SCM plugin.

      What would be the best way to release it back to this website? The original contributor of this plugin has not responded, and I would like to share it.

      My only problem is how. Can anyone of you either walk me through the bugfix process or through the process of registering a plugin?

      Thank you,

      Oliver

  10. Unknown User (wdevil)

    Hi Oliver.
    Why Subversion Release Manager skip 'This build requires parameters:' page when i click build link(for example: http://localhost:8080/job/test/releases/build?revision=3) in releases page? This page is displayed when i click build link(for example: http://localhost:8080/job/test/build?delay=0sec) in jobs list page.

  11. Unknown User (liori)

    It would be nice to have svn external definitions also reverted to same revision. I currently use a one-liner as a shell build step:

    svn up -r 1234; svn status | grep ^X | cut -c9 | xargs -L1 svn up -r 1234
    
  12. Unknown User (jimsearle)

    The issue mentioned in the original description is still not fixed in this plugin?

    http://issues.jenkins-ci.org/browse/JENKINS-3207

    Even though "korpo" says they have a fix to submit back?  Is the original author gone?

  13. Unknown User (srvijayaragavan)

    Every time the source code is checked out and not updated. Can i know how can I just update the sources?

    I tried with a boolean paramertization too. but i am not sure i have done correctly that. Please let me know what should i use it Boolean Value :  field.

    Thanks a ton.

    Vijay S

  14. Unknown User (bti_jenkinsuser)

    Hello,

    Can you checkout a specific revision number using this plugin with Jenkins ver. 2.32.1? 

    Thanks!