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
def getMergeRequestId() { | |
sh "git show -s --format='%B' > commitmsg" | |
msg = readFile 'commitmsg'; msg = msg.trim() | |
def mr_id_match = msg =~ /!(\d+)/ | |
if ( mr_id_match ) { | |
mr_id = mr_id_match[0][1] | |
echo "Found merge request ID $mr_id" | |
} else { mr_id = null } | |
mr_id_match = null // have to null this or we'll get NotSerializable errors from Jenkins | |
env.mergeRequestId = mr_id // set this so it can be used in the shell |
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
export PS1="\u@\H \w \$(parse_git_branch)\$ " | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
ref=${ref#refs/heads/} | |
unpushed=$(git log origin/$ref..$ref 2> /dev/null) || return | |
if [ "$unpushed" ]; then | |
warn=' - UNPUSHED!' | |
fi | |
echo "("$ref$warn")" |