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

Unable to use an env. variable for SCM_BRANCH configuration

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I use parametrized Jenkins Build to choise a git branch to build

      In Ansible Tower configuration I refer to this variable

      The environmental variables of my Build containd this Parameter

      But in Ansible Tower I see unresolved variable.

       

      Versions:

      • Ansible-Tower-Plugin: 0.15.0
      • Jenkins: 2.222.3
      • Ansible Tower: 3.6.2

       

       

        Attachments

          Activity

          Hide
          onewithforce Alex Pekaliev added a comment -

          We faced same issue with old and new version and to be even more interesting fields like fields like - Job-tags and skip-tags are reporting the variable fine. 

          Seems that only one, which give the string is SCM_BRANCH. 

           

          Show
          onewithforce Alex Pekaliev added a comment - We faced same issue with old and new version and to be even more interesting fields like fields like - Job-tags and skip-tags are reporting the variable fine.  Seems that only one, which give the string is SCM_BRANCH.   
          Hide
          onewithforce Alex Pekaliev added a comment -

          Thanks to some debugging and a close eye of a colleague of mine , we do believe the issue resides on a wrongly passed variable.

           

          Here is what the code does on line 106 :

          String expandedScmBranch = envVars.expand(scmBranch);
           

           

          Now, let's see what is actually passed to Tower :

          this.myJob.setJobId(myTowerConnection.submitTemplate(template.getInt("id"), expandedExtraVars, expandedLimit, expandedJobTags, expandedSkipJobTags, jobType, expandedInventory, expandedCredential, scmBranch, templateType));
           

          It should be expandedScmBranch instead of scmBranch. 

          Hopefully will find time next week to recompile (for a first time) a plugin and give it a try. 

          Georg Koch, if you found a different solution - do not hesitate to share it.

          Show
          onewithforce Alex Pekaliev added a comment - Thanks to some debugging and a close eye of a colleague of mine , we do believe the issue resides on a wrongly passed variable.   Here is what the code does on line 106 : String expandedScmBranch = envVars.expand(scmBranch);     Now, let's see what is actually passed to Tower : this.myJob.setJobId(myTowerConnection.submitTemplate(template.getInt("id"), expandedExtraVars, expandedLimit, expandedJobTags, expandedSkipJobTags, jobType, expandedInventory, expandedCredential, scmBranch, templateType));   It should be expandedScmBranch instead of scmBranch.  Hopefully will find time next week to recompile (for a first time) a plugin and give it a try.  Georg Koch , if you found a different solution - do not hesitate to share it.
          Hide
          onewithforce Alex Pekaliev added a comment -

          Plugin rebuild led to a successful result. 

          Code was modified to use expandedScmBranch instead of scmBranch when passing the data to Tower.

          Show
          onewithforce Alex Pekaliev added a comment - Plugin rebuild led to a successful result.  Code was modified to use expandedScmBranch instead of scmBranch when passing the data to Tower.

            People

            Assignee:
            johnwestcottiv John Westcott
            Reporter:
            codizz Georg Koch
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: