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

Add option to pass custom paramters from multibranch to the trigger jobs

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.8

      Description

      It would be nice to have additional option in the multichannel pipline configuration to specify custom parameters to pass to the tirgger job.

      The problem we are facing right now is next. We have a lot of multibranch projects for different apps: 

       

       

      app1
      
          master branch
      
          feature1
      
      app2
      
          master
      
      app3
      
         ....
       
      

       

      But for most of those apps the OnDelete trigger job performs the same steps. The only difference is that we need to cleanup resources according to the app name. We want to have only one OnDelete job for all those multibranch projects but provide parameters together with SOURCE_PROJECT_NAME param to indicate for what app we've triggered job.

      Also it might be useful to pass other custom parameters from the upstream job.

        Attachments

          Activity

          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Hi,

          I understand the situation you are having. It make sense when you have lots of jobs/branches. For a quick solution I can add another parameter with the Full name of the branch job ( Ex: app1/master) which calls the onDelete Trigger Job. Is this okay ?

          For adding custom parameters from the upstream job, I need to understand requirements well, can you give more detailed example ?

          Thanks for the suggestions!

          Show
          aytuncbeken Aytunc BEKEN added a comment - Hi, I understand the situation you are having. It make sense when you have lots of jobs/branches. For a quick solution I can add another parameter with the Full name of the branch job ( Ex: app1/master) which calls the onDelete Trigger Job. Is this okay ? For adding custom parameters from the upstream job, I need to understand requirements well, can you give more detailed example ? Thanks for the suggestions!
          Hide
          oleksii_baranov Oleksii Baranov added a comment -

          Hi Aytunc,

          Adding another parameters with the upstream multibranch job full name and branch (app1/master) sounds like a good idea and will unblock us.

          Regarding custom parameters. I think here what we need:

           - plugin should provide UI to define a list of parameters which will be passed to the trigger job as the job parameters. For example, in our case, we need to pass the KUBERNETES_NAMESPACE_NAME to the trigger job to understand what namespace to cleanup once branch is removed. I imagine that we may want to pass something else, like, ENVIRONMENT (preprod, preview, prod).
           - I don't think we need to try and create those parameters in the trigger job.

           

           

          Show
          oleksii_baranov Oleksii Baranov added a comment - Hi Aytunc, Adding another parameters with the upstream multibranch job full name and branch (app1/master) sounds like a good idea and will unblock us. Regarding custom parameters. I think here what we need:  - plugin should provide UI to define a list of parameters which will be passed to the trigger job as the job parameters. For example, in our case, we need to pass the KUBERNETES_NAMESPACE_NAME to the trigger job to understand what namespace to cleanup once branch is removed. I imagine that we may want to pass something else, like, ENVIRONMENT (preprod, preview, prod).  - I don't think we need to try and create those parameters in the trigger job.    
          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Hi,

          Full name parameters is released with the 1.6 version, probably It will be downloadable soon.
          For the other parameters thing, I need to work on it.

          Show
          aytuncbeken Aytunc BEKEN added a comment - Hi, Full name parameters is released with the 1.6 version, probably It will be downloadable soon. For the other parameters thing, I need to work on it.
          Hide
          pbx_g33k Oguzhan Uysal added a comment -

          Hi,

           

          We're having a similar where we use a multibranch project with parameterized builds. Is it not possible to pass the parameters through so the jobs that we trigger have access to upstream parameters.

          Show
          pbx_g33k Oguzhan Uysal added a comment - Hi,   We're having a similar where we use a multibranch project with parameterized builds. Is it not possible to pass the parameters through so the jobs that we trigger have access to upstream parameters.
          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Hi, I started working on it. Probably release in one week.

          Show
          aytuncbeken Aytunc BEKEN added a comment - Hi, I started working on it. Probably release in one week.
          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Hi,

          Adding custom parameters feature is released with 1.8 version. Probably It will be available soon in the plugin site.
          Please let me know, then I will close the ticket.

          Thanks.

          Show
          aytuncbeken Aytunc BEKEN added a comment - Hi, Adding custom parameters feature is released with 1.8 version. Probably It will be available soon in the plugin site. Please let me know, then I will close the ticket. Thanks.
          Hide
          pbx_g33k Oguzhan Uysal added a comment - - edited

          Hi Aytunc BEKEN,

          Works like a charm, and having support for environment variables as values makes it even better. Thanks for picking this up quickly.

          I spoke too soon sorry. 

          In our multibranch project we define parameters and environment variables in the jenkinsfile to determine if a deployment should take place and to which environment. These values are dynamic and assigned to the env in the build context. Is it possible to pass these dynamic values to the job triggered by this plugin?

          setting `${ENV}` passes the literal string instead of the expected value

          Show
          pbx_g33k Oguzhan Uysal added a comment - - edited Hi Aytunc BEKEN , Works like a charm, and having support for environment variables as values makes it even better. Thanks for picking this up quickly. I spoke too soon sorry.  In our multibranch project we define parameters and environment variables in the jenkinsfile to determine if a deployment should take place and to which environment. These values are dynamic and assigned to the env in the build context. Is it possible to pass these dynamic values to the job triggered by this plugin? setting `${ENV}` passes the literal string instead of the expected value
          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Hi,

          To be in the same page, I will write what I understood.
          You have your parameters/variables in your Jenkins file.g
          So you are asking if it is possible to pass these parameters/variables to the jobs which are triggered by this plugin.
          If this is the case, I need search if it is possible or not. Because triggering occurs in the Jenkins branch indexing action which is before checking the Jenkinsfile.

          As this is different from the current enhancement. I will be glad if you can open a new ticket so I can close this.

          Thanks.

          Show
          aytuncbeken Aytunc BEKEN added a comment - Hi, To be in the same page, I will write what I understood. You have your parameters/variables in your Jenkins file.g So you are asking if it is possible to pass these parameters/variables to the jobs which are triggered by this plugin. If this is the case, I need search if it is possible or not. Because triggering occurs in the Jenkins branch indexing action which is before checking the Jenkinsfile. As this is different from the current enhancement. I will be glad if you can open a new ticket so I can close this. Thanks.
          Hide
          pbx_g33k Oguzhan Uysal added a comment -

          Hi,

          Your interpretation of my issue/request is correct. As requested i have opened a new issue, https://issues.jenkins-ci.org/browse/JENKINS-61027.
          Thank you for your help. 

          Show
          pbx_g33k Oguzhan Uysal added a comment - Hi, Your interpretation of my issue/request is correct. As requested i have opened a new issue,  https://issues.jenkins-ci.org/browse/JENKINS-61027 . Thank you for your help. 
          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Thanks a lot.

          Oleksii Baranov I will close this issue as I assume it is working as requested.

          Show
          aytuncbeken Aytunc BEKEN added a comment - Thanks a lot. Oleksii Baranov I will close this issue as I assume it is working as requested.

            People

            Assignee:
            aytuncbeken Aytunc BEKEN
            Reporter:
            oleksii_baranov Oleksii Baranov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: