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

have ProjectNamingStrategy pass also the name of the parent

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • 2.367

      The checkName method of ProjectNamingStrategy currently only gets the plain potential jobname passed. What is missing is name of the parent (e.g. when the job is created inside a folder). While in a UI context one can obtain the parent from the stapler context, this doesn't work when one tries to create jobs via the CLI.

      So it would be beneficial if the the name of the parent is passed as additional parameter to the ProjectNamingStrategy and it is up to the naming strategy if it uses just the job name or the full name.

      Use case:

      the Rolestrategy plugin implements also a ProjectNamingStrategy to restrict which users can create which jobs. This is currently broken (https://issues.jenkins.io/browse/JENKINS-19934

      In order to be able to properly check the rules the naming strategy needs to know the full name of an item

          [JENKINS-68602] have ProjectNamingStrategy pass also the name of the parent

          There is an open pull request for this.

          Adrien Lecharpentier added a comment - There is an open pull request for this.

          Can you please open a downstream PR on the plugin that would use this new API. At the moment, the opened PR is not making any use of the new parameter and, even if I think I see what you want to do, a valid implementation using the API would be a great addition to this contribution.

          Adrien Lecharpentier added a comment - Can you please open a downstream PR on the plugin that would use this new API. At the moment, the opened PR is not making any use of the new parameter and, even if I think I see what you want to do, a valid implementation using the API would be a great addition to this contribution.

            Unassigned Unassigned
            mawinter69 Markus Winter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: