Skip to content

Instantly share code, notes, and snippets.

View CosetteN's full-sized avatar

CosetteN CosetteN

  • Intelisys, a ScanSource Company
  • Chattanooga, TN
View GitHub Profile
@CosetteN
CosetteN / jenkinsConfirmGit.exp
Last active February 1, 2017 23:52
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.
# 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.