Skip to content

Instantly share code, notes, and snippets.


CosetteN CosetteN

  • Library Ideas, LLC
  • Chattanooga, TN
View GitHub Profile
CosetteN / jenkinsConfirmGit.exp
Last active Feb 1, 2017
Expect script for Jenkins to determine if current git branch is desired branch. Using "git branch" & matching the current branch with the * worked in terminal but not when started by Jenkins. Script returns only the current branch name, w/out the asterisk, allowing pattern match to work as expected.
View jenkinsConfirmGit.exp
# Your script here that logs into your git repo
expect "$"
# Echo current git branch without the dreaded *.
send "git rev-parse --abbrev-ref HEAD\r"
expect {
default {
#If current branch isn't what you want to test on, error out to ensure Jenkins recognizes problem.