In Jenkins 2.19.2, I now have three different pipeline jobs using a variation of the same script components, including a bunch of methods that I've pasted into each script. I'm storing each script in git, but I think it's now time to define a shared library so I can remove the duplicated methods.
So, I created a git repo with the "src", "vars", and "resources" structure (initial test only has a single class in the "src" tree), and referenced that repo from the shared library definition.
I first noticed that something might be wrong when I entered "1.0" in the "Default Version" field and it printed "Cannot validate default version" below that. When I clicked on "show details" it said something like this:
hudson.plugins.git.GitException: Command "/opt/app/git/1.9.0-0.14/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: I don't handle protocol 'git clone ssh'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
Even with this, I went ahead and tried adding the reference to the library in one of my pipeline scripts, only to reference the single class I put in the library (a simple enum definition). In the build output, the first reference to the repo containing the shared library looks like this:
Setting origin to git clone ssh://git@.../usl_jenkins_library.git
> /opt/app/git/1.9.0-0.14/bin/git config remote.origin.url git clone ssh://git@.../usl_jenkins_library.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
> /opt/app/git/1.9.0-0.14/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /opt/app/git/1.9.0-0.14/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
hudson.plugins.git.GitException: Command "/opt/app/git/1.9.0-0.14/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: I don't handle protocol 'git clone ssh'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
If it matters, I modified my pipeline script to look like this:
@Library("usl-pipeline-library")
import com.att.usl.jenkins.BUILD_STATUS
import groovy.xml.*
import java.nio.file.*
import hudson.model.*
import hudson.triggers.*
import hudson.plugins.git.GitStatus
What might I be doing wrong here?