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

git scm poll not working with global environment variable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      Steps to reproduce -

      Manage Jenkins => Configure System => Global properties => Environment variables
      Add
      Name = GITHUB_HOST
      Value = <github IP address>

      Name = GITHUB_REPO
      Value = <github repo path>

      Create a job
      Under job configuration define git repository as below
      https://$

      {GITHUB_HOST}/${GITHUB_REPO}
      provide user/pass for credential
      complete the job configuration

      Trigger SCM poll by using curl (Note - provide your Jenkins host in following command)

      curl http://${JENKINS_SERVER}/jenkins/git/notifyCommit?url=[https://\$|https://%24/]"{GITHUB_HOST}"/\$"{GITHUB_REPO}"

      It'll poll the corresponding job but if you see Git SCM poll log, it's dumping the following error
      In short - It's not able to expand the global variable

      > /usr/bin/git --version # timeout=10
      > /usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}

      /${GITHUB_REPO} +refs/heads/:refs/remotes/origin/
      FATAL: hudson.plugins.git.GitException: Failed to fetch from https://$

      {GITHUB_HOST}/${GITHUB_REPO}
      hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}

      /${GITHUB_REPO}
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
      at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
      at hudson.scm.SCM.poll(SCM.java:398)
      at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
      at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
      at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:119)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:526)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:555)
      at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: hudson.plugins.git.GitException: Failed to fetch from https://$

      {GITHUB_HOST}/${GITHUB_REPO}
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
      ... 14 more
      Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}

      /${GITHUB_REPO} +refs/heads/:refs/remotes/origin/" returned status code 128:
      stdout:
      stderr: remote: Invalid username or password.
       

          [JENKINS-34603] git scm poll not working with global environment variable

          smruti sahoo created issue -
          smruti sahoo made changes -
          Description Original: Steps to reproduce -

          Manage Jenkins => Configure System => Global properties => Environment variables
          Add
          Name = GITHUB_HOST
          Value = <github IP address>

          Name = GITHUB_REPO
          Value = <github repo path>

          Create a job
          Under job configuration define git repository as below
          https://${GITHUB_HOST}/${GITHUB_REPO}
          provide user/pass for credential
          complete the job configuration

          Trigger SCM poll by using curl (Note - provide your Jenkins host in following command)

          curl http://${JENKINS_SERVER}/jenkins/git/notifyCommit?url=https://\$"\{GITHUB_HOST\}"/\$"\{GITHUB_REPO\}"

          It'll poll the corresponding job but if you see Git SCM poll log, it's dumping the following error
          {color:red}It's not able to expand the global variable {color}

           > /usr/bin/git --version # timeout=10
           > /usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*
          FATAL: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
          at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
          at hudson.scm.SCM.poll(SCM.java:398)
          at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
          at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
          at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:119)
          at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:526)
          at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:555)
          at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
          Caused by: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
          ... 14 more
          Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: remote: Invalid username or password.

          New: Steps to reproduce -

          Manage Jenkins => Configure System => Global properties => Environment variables
          Add
          Name = GITHUB_HOST
          Value = <github IP address>

          Name = GITHUB_REPO
          Value = <github repo path>

          Create a job
          Under job configuration define git repository as below
          https://${GITHUB_HOST}/${GITHUB_REPO}
          provide user/pass for credential
          complete the job configuration

          Trigger SCM poll by using curl (Note - provide your Jenkins host in following command)

          curl http://${JENKINS_SERVER}/jenkins/git/notifyCommit?url=https://\$"\{GITHUB_HOST\}"/\$"\{GITHUB_REPO\}"

          It'll poll the corresponding job but if you see Git SCM poll log, it's dumping the following error
          {color:red}In short - It's not able to expand the global variable {color}

           > /usr/bin/git --version # timeout=10
           > /usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*
          FATAL: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
          at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
          at hudson.scm.SCM.poll(SCM.java:398)
          at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
          at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
          at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:119)
          at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:526)
          at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:555)
          at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
          Caused by: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
          ... 14 more
          Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: remote: Invalid username or password.

          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 170764 ] New: JNJira + In-Review [ 184029 ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-49758 [ JENKINS-49758 ]
          Mark Waite made changes -
          Labels New: newbie-friendly
          Mark Waite made changes -
          Priority Original: Critical [ 2 ] New: Minor [ 4 ]
          Benjamin Cross made changes -
          Description Original: Steps to reproduce -

          Manage Jenkins => Configure System => Global properties => Environment variables
          Add
          Name = GITHUB_HOST
          Value = <github IP address>

          Name = GITHUB_REPO
          Value = <github repo path>

          Create a job
          Under job configuration define git repository as below
          https://${GITHUB_HOST}/${GITHUB_REPO}
          provide user/pass for credential
          complete the job configuration

          Trigger SCM poll by using curl (Note - provide your Jenkins host in following command)

          curl http://${JENKINS_SERVER}/jenkins/git/notifyCommit?url=https://\$"\{GITHUB_HOST\}"/\$"\{GITHUB_REPO\}"

          It'll poll the corresponding job but if you see Git SCM poll log, it's dumping the following error
          {color:red}In short - It's not able to expand the global variable {color}

           > /usr/bin/git --version # timeout=10
           > /usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*
          FATAL: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
          at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
          at hudson.scm.SCM.poll(SCM.java:398)
          at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
          at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
          at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:119)
          at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:526)
          at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:555)
          at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
          Caused by: hudson.plugins.git.GitException: Failed to fetch from https://${GITHUB_HOST}/${GITHUB_REPO}
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
          ... 14 more
          Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress https://${GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: remote: Invalid username or password.

          New: Steps to reproduce -

          Manage Jenkins => Configure System => Global properties => Environment variables
           Add
           Name = GITHUB_HOST
           Value = <github IP address>

          Name = GITHUB_REPO
           Value = <github repo path>

          Create a job
           Under job configuration define git repository as below
           [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO}
           provide user/pass for credential
           complete the job configuration

          Trigger SCM poll by using curl (Note - provide your Jenkins host in following command)

          curl [http://$|http://%24/]{JENKINS_SERVER}/jenkins/git/notifyCommit?url=[https://\$|https://%24/]"\{GITHUB_HOST}"/\$"\{GITHUB_REPO}"

          It'll poll the corresponding job but if you see Git SCM poll log, it's dumping the following error
           {color:#FF0000}In short - It's not able to expand the global variable {color}

          > /usr/bin/git --version # timeout=10
           > /usr/bin/git -c core.askpass=true fetch --tags --progress [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*
           FATAL: hudson.plugins.git.GitException: Failed to fetch from [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO}
           hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO}
           at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
           at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
           at hudson.scm.SCM.poll(SCM.java:398)
           at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
           at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
           at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
           at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:119)
           at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:526)
           at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:555)
           at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
           at java.util.concurrent.FutureTask.run(FutureTask.java:262)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
           at java.lang.Thread.run(Thread.java:745)
           Caused by: hudson.plugins.git.GitException: Failed to fetch from [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO}
           at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
           at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
           at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
           ... 14 more
           Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress [https://$|https://%24/]{GITHUB_HOST}/${GITHUB_REPO} +refs/heads/*:refs/remotes/origin/*" returned status code 128:
           stdout:
           stderr: remote: Invalid username or password.
           
          R. Fitzner made changes -
          Attachment New: poll_error_after_restart.png [ 55312 ]
          Mark Waite made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Mark Waite made changes -
          Labels Original: newbie-friendly

            Unassigned Unassigned
            smruti_sahoo smruti sahoo
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: