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

Impossible to have an invisible property on View that is persisted on save



    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • core
    • None
    • Jenkins 2.214


      DescriptorVisibilityFilter is not used to filter properties that are displayed on the View edition.

      The same method View.getApplicablePropertyDescriptors() is used both to filter displayed properties on UI and to filter properties that are saved with the View.

      The only way to not show a property in UI is to use ViewPropertyDescriptor but then the property is not persisted and is removed when the users edit view and save it.

      public static final class DescriptorImpl extends ViewPropertyDescriptor {
          public boolean isEnabledFor(View view) {
              return false;

      That means that it's not possible to have some hidden properties for View that are persisted.

      This method is used in jelly to filter properties:

      And it's also used in View to filter properties that are persisted:

      I looked at Job configuration, a specific method based on DescriptorVisibilityFilter is used in jelly.

      So this code should work for View when a plugin need to have an invisible property:

      public static final class DescriptorVisibilityFilterImpl extends DescriptorVisibilityFilter {
          public boolean filter(Object context, Descriptor descriptor) {
              return false;

      I propose to add a new method in View to filter properties that use DescriptorVisibilityFilter to filter properties visible on UI and use it in View/configure.jelly.

      Rule test to reproduce the issue and the proposed correction are done in the PR: https://github.com/jenkinsci/jenkins/pull/4404



          oleg_nenashev Oleg Nenashev added a comment -

          ajard if you would like ti get it backported to LTS, please mark it as an LTS candidate

          oleg_nenashev Oleg Nenashev added a comment - ajard if you would like ti get it backported to LTS, please mark it as an LTS candidate


            ajard A. Jard
            ajard A. Jard
            0 Vote for this issue
            2 Start watching this issue