Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8039

AccuRev snapshot name incorrect

    XMLWordPrintable

Details

    Description

      Summary:

      Issue JENKINS-5195 introduced a (much needed) feature to create a snapshot of the code being built.
      This specified that the snapshot name would be prefixed by the AccuRev stream name.
      This wasn't done - the Hudson job name was used instead.

      Details:

      Hudson job names aren't subject to the same restrictions as AccuRev snapshot names, which can result in invalid snapshot names being tried.
      e.g. a Hudson project name of "010_My_Project" sourced from AccuRev stream "MyProject" being built as build number 1234 would attempt to use a snapshot name of "010_My_Project_1234" which fails with the error:
      Invalid stream name. Streams must begin with a non-digit other than "." and cannot contain the characters '\' or '/'

      The snapshot name should be prefixed by the AccuRev stream name, as originally proposed.
      However, it should probably also include the Hudson project name as well, in order to work around AccuRev's limitation that snapshot names be globally unique (not merely unique within the stream they apply to).

      i.e. instead of

      HudsonProjectName_BuildNumber

      the snapshot name should be

      AccurevStreamName_HudsonProjectName_BuildNumber

      Workaround

      Rename all your Hudson projects to meet with AccuRev's snapshot name restrictions.

      Attachments

        Issue Links

          Activity

            pjdarton pjdarton added a comment -

            Note that the code responsible for this issue, https://hudson.dev.java.net/svn/hudson/trunk/hudson/plugins/accurev/src/main/java/hudson/plugins/accurev/AccurevSCM.java,

            AccurevSCM.java
            ...
            // TODO Allow a flexible snapshot naming convention
            String snapshotName = build.getProject().getName() + "_" + build.getNumber();
            ...
            

            contains a TODO which, if implemented, could obsolete this fault.
            It may not be much more effort to implement that enhancement as it would be to just fix this fault, and that enhancement would be very welcome.

            e.g. one could add a user-editable string, then use String.format on that string, passing in things like build.getProject().getName(), the accurev stream name, the build number etc as arguments, and indicate which argument is which in the help text.
            That'd then allow me to name my snapshots AccuRevStreamName_Source_BuildNumber using a string like "{0}_Source_{2}".

            pjdarton pjdarton added a comment - Note that the code responsible for this issue, https://hudson.dev.java.net/svn/hudson/trunk/hudson/plugins/accurev/src/main/java/hudson/plugins/accurev/AccurevSCM.java , AccurevSCM.java ... // TODO Allow a flexible snapshot naming convention String snapshotName = build.getProject().getName() + "_" + build.getNumber(); ... contains a TODO which, if implemented, could obsolete this fault. It may not be much more effort to implement that enhancement as it would be to just fix this fault, and that enhancement would be very welcome. e.g. one could add a user-editable string, then use String.format on that string, passing in things like build.getProject().getName(), the accurev stream name, the build number etc as arguments, and indicate which argument is which in the help text. That'd then allow me to name my snapshots AccuRevStreamName _Source_ BuildNumber using a string like "{ 0}_Source_{2 }".
            pjdarton pjdarton added a comment -

            Patch that makes the snapshot name configurable.
            Created by doing "git format-patch origin" and then zipping up the resulting patch files.

            pjdarton pjdarton added a comment - Patch that makes the snapshot name configurable. Created by doing "git format-patch origin" and then zipping up the resulting patch files.
            pjdarton pjdarton added a comment -

            I've uploaded a patch that obsoletes this fault by resolving the "TODO" comment mentioned above by making the snapshot name fully configurable whilst retaining the existing (IMO incorrect) default.

            If this patch were merged into the main stream, it'd make this issue rather a non-issue, as the "workaround" would be to configure the snapshot name to whatever you wanted it to be instead of leaving it as the default.
            In order to fully fix this issue, one would also have to also change the default snapshot name (AccurevSCM.java's DEFAULT_SNAPSHOT_NAME_FORMAT string) from "${JOB_NAME}${BUILD_NUMBER}" to "${ACCUREV_STREAM}${BUILD_NUMBER}", but this would change the default behavior, which may or may not be what other users expect.

            In other words, I've been a bit of a coward and preserved the existing behaviour whilst adding functionality that allows me to have the plugin work the way I want it to work.

            pjdarton pjdarton added a comment - I've uploaded a patch that obsoletes this fault by resolving the "TODO" comment mentioned above by making the snapshot name fully configurable whilst retaining the existing (IMO incorrect) default. If this patch were merged into the main stream, it'd make this issue rather a non-issue, as the "workaround" would be to configure the snapshot name to whatever you wanted it to be instead of leaving it as the default. In order to fully fix this issue, one would also have to also change the default snapshot name (AccurevSCM.java's DEFAULT_SNAPSHOT_NAME_FORMAT string) from "${JOB_NAME} ${BUILD_NUMBER}" to "${ACCUREV_STREAM} ${BUILD_NUMBER}", but this would change the default behavior, which may or may not be what other users expect. In other words, I've been a bit of a coward and preserved the existing behaviour whilst adding functionality that allows me to have the plugin work the way I want it to work.

            patch for this issue is included in the 0.6.15 plugin

            helterscelter helter scelter added a comment - patch for this issue is included in the 0.6.15 plugin

            People

              helterscelter helter scelter
              pjdarton pjdarton
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: