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

lockable-resources resource autocomplete creates faulty resource names

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • lockable-resources plugin 2.0

      Locking a job with a resource name won't work, if using the autocompleted resource name. Two jobs requiring the same lock can be run in parallel.

      Steps to reproduce:

      1. In the Jenkins configuration, create a lockable resource called 'abcd'
      2. Create a new freestyle job, in the configuration choose 'This build requires lockable resources' and type 'ab' to 'Resources'. The autocomplete should now offer you 'abcd', click on that.
      3. Click save.
      4. Build your new project.
      5. Open the console. It should say

      [lockable-resources] acquired lock on [](it should have said acquired lock on [abcd].

      The problem seems to be, that the plugin writes to the jobs config.xml an extra space character, e.g.

      <resourceNames>abcd </resourceNames>

      instead of <resourceNames>abcd</resourceNames>

       

       

          [JENKINS-47235] lockable-resources resource autocomplete creates faulty resource names

          Aleksi Aalto added a comment -

          Added a PR: https://github.com/jenkinsci/lockable-resources-plugin/pull/76

          This solves the trailing whitespace in config.xm problem, but not the "acquired lock on []" problem, which seems to be a different one.

          Aleksi Aalto added a comment - Added a PR: https://github.com/jenkinsci/lockable-resources-plugin/pull/76 This solves the trailing whitespace in config.xm problem, but not the "acquired lock on []" problem, which seems to be a different one.

          Code changed in jenkins
          User: Aleksi Aalto
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/300d4b1d6aae030daba46e174b507a5a00e38630
          Log:
          Trim trailing whitespace in resourcenames

          If not trimmed, the trailing whitespaces will find their way
          to the jobs config.xml, causing confusion.

          Trailing whitespaces in resourcenames are caused also by the
          autocompletion script, that suggests resourcenames.

          JIRA Issue: https://issues.jenkins-ci.org/browse/JENKINS-47235

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Aleksi Aalto Path: src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java http://jenkins-ci.org/commit/lockable-resources-plugin/300d4b1d6aae030daba46e174b507a5a00e38630 Log: Trim trailing whitespace in resourcenames If not trimmed, the trailing whitespaces will find their way to the jobs config.xml, causing confusion. Trailing whitespaces in resourcenames are caused also by the autocompletion script, that suggests resourcenames. JIRA Issue: https://issues.jenkins-ci.org/browse/JENKINS-47235

          Andrew Bayer added a comment - - edited

          Merged, releasing now as 2.1

          Andrew Bayer added a comment - - edited Merged, releasing now as 2.1

            Unassigned Unassigned
            aga Aleksi Aalto
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: