-
Bug
-
Resolution: Unresolved
-
Minor
in the pipeline step: checkout step, use "branches to build" with commitID
generated by snippet and it works:
node('master'){
stage("1")
}
but same code in the shared library does not work:
class Git implements Serializable {
def checkoutScm()
}
}
node('master'){
stage("1"){
def git = new Git()
git.checkoutScm()
Compared with the console, the difference in the later is:
Fetching upstream changes from ssh://git@gitlab.is.com:7999/myRepo.git
> /usr/bin/git fetch --tags --progress ssh://git@gitlab.is.com:7999/myRepo.git +refs/heads/:refs/remotes/origin/
> /usr/bin/git rev-parse refs/remotes/origin/fc5c534716c171a03eeb31a12c1e0acff700dcbf^
> /usr/bin/git rev-parse refs/remotes/origin/origin/fc5c534716c171a03eeb31a12c1e0acff700dcbf^{commit}
# timeout=10
> /usr/bin/git rev-parse origin/fc5c534716c171a03eeb31a12c1e0acff700dcbf^
I assume, git rev-parse should done as
/usr/bin/git rev-parse fc5c534716c171a03eeb31a12c1e0acff700dcbf^{commit}
when the input is a commitId than a real branch name
so why it tries "refs/remote/origin", " refs/remote/origin/origin", "origin" instead?
What's the path for your shared library file? If it's in src/..., that's expected. You shouldn't call steps (like checkout) from classes in src/....