I do believe the plugin sets the var you want. have a look at Environment variables here: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures
On Thu, Nov 12, 2015 at 12:41 PM, Jens Wilke <[email protected]> wrote: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/e4bdb5bb-6d1e-4459-8e1c-03483e2a945a%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/e4bdb5bb-6d1e-4459-8e1c-03483e2a945a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtXnp%2B9CVq0euJK4FnT-tfB%3DHb0OnNVAJaC%3Dkxq75tozzQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
