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

add - none - to image tags list

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
    • Environment:
      Jenkins 2.277.4
      Pipeline: Shared Groovy Libraries 2.19
      Pipeline: Multibranch: 2.23
    • Similar Issues:

      Description

      Hi Stéphane Nsakala ,

      first of all, thank you for your awesome plugin.

      I have a scenario which I need to provide multiple Image Tag Parameters for several services. But in some cases, I would like not to choose one of them, and instead to choose "- none -" on a specific service.

      So It will be awesome to have also "- none -" as part of the tag list, just like credentials list has.

      which will return empty string to those env vars

      %s_IMAGE = ""
      %s_IMAGE_TAG = ""
      %s_IMAGE_IMAGE = ""
      

      or

      will not inject those envs at all

      What do you think about this feature?

       

        Attachments

          Activity

          Hide
          dordor dor s added a comment -

          here is some idea and pseudo code of how to implement this:

          https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/resources/io/jenkins/plugins/luxair/ImageTagParameterDefinition/config.jelly (under line 37)

           

                  <f:entry title="${%Enable none}" field="none">
                      <f:boolean default=false />
                  </f:entry>
          

          https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/java/io/jenkins/plugins/luxair/ImageTag.java (under line 70)

          if (field_none == true){
            container.append(" - none -")
          }

          https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/java/io/jenkins/plugins/luxair/ImageTagParameterValue.java 

                  // exposes ImageName
                  if (! field_none){
                    env.put(String.format("%s_IMAGE", name), imageName);
                    env.put(String.format("%s_IMAGE", name).toUpperCase(Locale.ENGLISH), imageName); // backward compatibility pre 1.345
                  } 
                  else {
                    env.put(String.format("%s_IMAGE", name), "");
                  }
                  ...
          
          

          I'm really noob on java, so I can't help here. 

          But hope that this idea can help to improve your plugin a bit more to fit my (and maybe others) use case.

           

           

           

          Show
          dordor dor s added a comment - here is some idea and pseudo code of how to implement this: https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/resources/io/jenkins/plugins/luxair/ImageTagParameterDefinition/config.jelly  (under line 37)   <f:entry title= "${%Enable none}" field= "none" > <f: boolean default = false /> </f:entry> https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/java/io/jenkins/plugins/luxair/ImageTag.java  (under line 70) if (field_none == true ){ container.append( " - none -" ) } https://github.com/jenkinsci/image-tag-parameter-plugin/blob/master/src/main/java/io/jenkins/plugins/luxair/ImageTagParameterValue.java   // exposes ImageName if (! field_none){ env.put( String .format( "%s_IMAGE" , name), imageName); env.put( String .format( "%s_IMAGE" , name).toUpperCase(Locale.ENGLISH), imageName); // backward compatibility pre 1.345 } else { env.put( String .format( "%s_IMAGE" , name), ""); } ... I'm really noob on java, so I can't help here.  But hope that this idea can help to improve your plugin a bit more to fit my (and maybe others) use case.      

            People

            Assignee:
            maduma Stéphane Nsakala
            Reporter:
            dordor dor s
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: