Skip to content

Instantly share code, notes, and snippets.

@DEAD10CC
Created May 10, 2017 07:46
Show Gist options
  • Select an option

  • Save DEAD10CC/163db4d24568686a00f0c356b181e160 to your computer and use it in GitHub Desktop.

Select an option

Save DEAD10CC/163db4d24568686a00f0c356b181e160 to your computer and use it in GitHub Desktop.
Preparation script for Jenkins Git branch selection
#!/usr/bin/env bash
export branches_filename=branches.properties
export branches=${HOME}/${branches_filename}
git fetch --all
git remote prune origin
echo -ne "branches=" > ${branches}
git branch -r | awk '/origin\/feature|bugfix/{printf "%s,", $1 }' | head -n 1 >> ${branches}
echo "" >> ${branches}
scp ${branches} jenkins@slave-1:~/${branches_filename}
@DEAD10CC
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment