Hi all,
for extracting a git revision and building a timestamp at the beginning of a job I have now the following code:
stage 'build'
node {
git '....'
sh 'xy=`git rev-parse HEAD | cut -c1-11`; echo -n $xy > git-revision'
def rev11 = readFile 'git-revision'
echo "Git revision ${rev11}"
def stamp = new java.text.SimpleDateFormat('yyyyMMddHHmmss').format(new Date())
echo stamp
...
}
At least building the git revision seams quite complicated. It would be great when the git SCM plugin sets the revision as a variable.
Is there a more crispy solution for this?
Cheers,
Jens