• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • branch-api-plugin
    • None
    • Jenkins 2.32.1, Bitbucket Branch Source Plugin 2.0.0

      Since the SCM 2.0 release, I can't find a way, in a pipeline, to get a human-readable job & branch name.

      For example, if I had a BitBucket team called 'Foo', a repository called 'Bar' and a branch 'feature/KEY-Baz', it used to be possible to get a nearly human readable branch - env.BRANCH_NAME would be 'Foo/Bar%2FKEY-Baz', which was easy enough to escape to a human readable form.

      Now, however, it's a shortened form, with numbers in it - something like 'Foo/Bar.qxyz123/feature-KEY.abcd12345ghij-Baz'. And there appears to be no way to get the human readable version. This has broken all of my build notification templates.

      Here's my 'build started' notification, for example:

      hipchatSend color: 'YELLOW', credentialId: 'HipChat', message: "<a href='${env.BUILD_URL}'>${env.JOB_NAME.replace('%2F', '/')} ${env.BUILD_NUMBER}</a> Started", notify: true, room: 'Build Server Messages', sendAs: 'Jenkins', server: '', v2enabled: false
      

          [JENKINS-41124] Can't get a human readable job name anymore

          Robert Watkins created issue -

          Probably similar to JENKINS-41104

          Robert Watkins added a comment - Probably similar to JENKINS-41104
          Robert Watkins made changes -
          Comment [ Ack! I just realised something more important - I can't find related projects to do things such as copy artefacts from upstream builds, because the repository name itself now has a suffix. I'll be raising another bug for that. ]

          This is also breaking my use of the S3BucketPublisher - It used to publish to S3 with a path prefix of (using the above) 'Foo/Bar/feature%2FBaz'.

          It now publishes with 'Foo/Bar.qxyz123/feature-KEY.abcd12345ghij-Baz'. I could probably live with the suffix on the project name (though that sucks, it is at least consistent), but the mangling of the branch name is horrible, as it's non-deterministic.

          At this point, I'm about to rollback to my backup and stick with the v1.0 version; notification templates were painful, but this is a problem that completely breaks my ops infrastructure.

          Robert Watkins added a comment - This is also breaking my use of the S3BucketPublisher - It used to publish to S3 with a path prefix of (using the above) 'Foo/Bar/feature%2FBaz'. It now publishes with 'Foo/Bar.qxyz123/feature-KEY.abcd12345ghij-Baz'. I could probably live with the suffix on the project name (though that sucks, it is at least consistent), but the mangling of the branch name is horrible, as it's non-deterministic. At this point, I'm about to rollback to my backup and stick with the v1.0 version; notification templates were painful, but this is a problem that completely breaks my ops infrastructure.
          Robert Watkins made changes -
          Priority Original: Major [ 3 ] New: Critical [ 2 ]

          I know the mangling of the paths is there to ensure uniqueness - but it's causing problems for me like crazy. An option to disable it would help a lot.

          Robert Watkins added a comment - I know the mangling of the paths is there to ensure uniqueness - but it's causing problems for me like crazy. An option to disable it would help a lot.

          env.BRANCH_NAME should now be the plain unmangled name

          Stephen Connolly added a comment - env.BRANCH_NAME should now be the plain unmangled name

          James Dumay added a comment -

          This should be BLOCKER. We can't go about breaking peoples URLs.

          James Dumay added a comment - This should be BLOCKER. We can't go about breaking peoples URLs.

          What about the job name? Is there a way to get an unmangled form of that?

          Robert Watkins added a comment - What about the job name? Is there a way to get an unmangled form of that?

          The S3BucketPublisher, BTW, uses run.getParent().getFullName(); to determine the prefix. If I can get an unmangled job name, I can do my own S3 uploads, but if I want to keep using this plugin, I need a way to make the parent's full name to be unmangled.

          Robert Watkins added a comment - The S3BucketPublisher, BTW, uses run.getParent().getFullName(); to determine the prefix. If I can get an unmangled job name, I can do my own S3 uploads, but if I want to keep using this plugin, I need a way to make the parent's full name to be unmangled.

            stephenconnolly Stephen Connolly
            twasink Robert Watkins
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: