how to get repo name in Jenkins pipeline -
i'm using jenkins scripted pipeline uses groovy style scripting, , created jenkinsfile describe pipeline. need create workspace folder name same git repo name, , checkout code in workspace folder. question is, before doing checkout scm
, there way know git repo name or git repo url?
string determinereponame() { return scm.getuserremoteconfigs()[0].geturl().tokenize('/')[3].split("\\.")[0] }
this relatively ugly code use reponame. key url of repo stored in:
scm.getuserremoteconfigs()[0].geturl()
from there need string ops want.
Comments
Post a Comment