Hello,

I have a really simple task - I need to configure jenkins job to build a 
code only when a new tags with specific names (for e.g. qa_1234567) are 
pushed to the git (github). I can't use webhooks because I don't have 
sufficient permissions to repository. So I have to use SCM polling model. I 
have configured freestyle job and specify the following info

Refspec
+refs/tags/*:refs/remotes/origin/tags/*

Branch Specifier (blank for 'any')
:.*/qa_[0-9]{6,10}$

All works fine except one thing. If I create a new tag and point it to any 
commit except head - it doesn't work. The job is not triggered. For e.g.

# git rev-parse HEAD
75c42ce06cbbff83e1640e4b7b28543ca6793167

# git tag qa_$(date '+%s') 863c7607 && git push -u origin --tags
Total 0 (delta 0), reused 0 (delta 0)
To ssh://g...@193.243.xxx.xxx:2222/test/p1.git
 * [new tag]         qa_1472930540 -> qa_1472930540


I can see the new tag in SCP Polling log

Seen branch in repository origin/tags/qa_1472930009
Seen branch in repository origin/tags/qa_1472930540
Seen 41 remote branches
Done. Took 0.37 sec
No changes

With head revision all works fine

$ UT=$(date '+%s'); echo ${UT} > 1 && git add . && git commit -m "${UT}" && 
git push -u origin api
[api 8f80708] 1472931220
 1 file changed, 1 insertion(+), 1 deletion(-)
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 268 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://g...@193.243.xxx.xxx:2222/test/p1.git
   75c42ce..8f80708  api -> api
Branch api set up to track remote branch api from origin.

$ git tag qa_$(date '+%s') 8f80708  && git push -u origin --tags
Total 0 (delta 0), reused 0 (delta 0)
To ssh://g...@193.243.xxx.xxx:2222/test/p1.git
 * [new tag]         qa_1472931234 -> qa_1472931234

Seen branch in repository origin/tags/qa_1472930009
Seen branch in repository origin/tags/qa_1472930540
Seen branch in repository origin/tags/qa_1472931137
Seen branch in repository origin/tags/qa_1472931234
Seen 43 remote branches
 > git log --full-history --no-abbrev --format=raw -M -m 
75c42ce06cbbff83e1640e4b7b28543ca6793167..8f807082e7c7dc3c33ea46dc6146b2bc5d3be3a8
 
# timeout=10
Done. Took 0.68 sec
Changes found

P.S.
I have read a lot of articles about the subject 

http://erics-notes.blogspot.com/2013/05/jenkins-build-latest-git-tag.html
http://www.cyber-tec.org/2015/09/20/build-last-git-tag-with-jenkins/

but can't find any suitable solution

Thanks in advance

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/72f3e6ee-1ef1-477b-ba74-5ce056b35c6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to