Created
May 14, 2018 19:22
-
-
Save jimklo/7593c68ef2c51cb1a5c951e061efd612 to your computer and use it in GitHub Desktop.
Issue with running this Pipeline Shared Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GitTool extends StepsBase { | |
def GitTool(steps) { | |
super(steps) | |
} | |
def runSh(script, returnStdout = false) { | |
def output = steps.sh(script: script, returnStdout: returnStdout) | |
return output.toString() | |
} | |
@NonCPS | |
def commitGitChanges(String path, String message, String gitEmail='[email protected]', String gitName='sunflower-build-bot') { | |
def git_cmd | |
steps.dir(path) { | |
runSh("git config --local user.email '${gitEmail}'".toString()) | |
runSh("git config --local user.name '${gitName}'".toString()) | |
runSh('git add -A') | |
git_cmd = runSh("git commit --message '${message}'".toString(), true) | |
} | |
return git_cmd | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StepsBase implements Serializable{ | |
def steps | |
StepsBase(steps=null) { | |
this.steps = steps | |
} | |
def log(message) { | |
if (this.steps) { | |
this.steps.println("${message}".toString()) | |
} else { | |
println(message) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment