title: Cannot run Shared Groovy library function
body: <p>I am in the process of setting up Jenkins pipeline builds and am starting to use the same methods across multiple jobs, so it's time to put these common methods into a shared library.</p>
  
  <p>The first function I have created is to update GitHub with the result of some unit tests. I am having an issue where I can run this function from the command line fine but when it comes to using it within my Jenkins build it does not work and I cannot seem to get any debug output in the Jenkins console</p>
  
  <p>This is the directory structure of my shared library</p>
  
  <pre><code>my-project
  src
  vars
    - getCommitId.groovy
    - gitUpdateStatus.groovy
  </code></pre>
  
  <p>So the first function <code>getCommitId</code> works fine</p>
  
  <pre><code>#!/usr/bin/env groovy
  def call() {
    commit_id = sh script: 'git rev-parse HEAD', returnStdout: true
    commit_id = commit_id.replaceAll("\\s","") // Remove Whitespace
    return commit_id
  }
  </code></pre>
  
  <p>This returns the correct value</p>
  
  <p>This is <code>gitUpdateStatus</code></p>
  
  <pre><code>#!/usr/bin/env groovy
  @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7')
  
  import static groovyx.net.http.ContentType.JSON
  import static groovyx.net.http.Method.POST
  import groovyx.net.http.HTTPBuilder
  
  
  String targetUrl = 'https://api.github.com/repos/myRepo/'
  def http = new HTTPBuilder(targetUrl)
  http.request(POST) {
    uri.path = "repo/statuses/12345678"
    requestContentType = JSON
    body = [state: 'success', description: 'Jenkins Unit Tests', target_url: 'http://test.co.uk', context: 'unit tests']
    headers.'Authorization' = "token myOauthTokenHere"
    headers.'User-Agent' = 'Jenkins Status Update'
    headers.Accept = 'application/json'
  
    response.success = { resp, json -&gt;
      println "GitHub updated successfully! ${resp.status}"
    }
  
    response.failure = { resp, json -&gt;
      println "GitHub update Failure! ${resp.status} " + json.message
    }
  }
  </code></pre>
  
  <p>I can run this fine via the command line, but I get no output when run as a Jenkins build.</p>
  
  <p>My Jenkinsfile</p>
  
  <pre><code>@Library('echo-jenkins-shared')_
  node {
    GIT_COMMIT_ID = getGitCommitId()
    echo "GIT COMMIT ID: ${GIT_COMMIT_ID}"
    gitUpdateStatus(GIT_COMMIT_ID)
  }
  </code></pre>
  
  <p>Why would this not work or could this be converted to just use native Groovy methods?</p>