[JIRA] (JENKINS-57772) Build strategy for tags is not working, if you specify ignore tags lesser than 7days

46 views
Skip to first unread message

ss_vinoth22@yahoo.co.in (JIRA)

unread,
May 30, 2019, 8:08:02 PM5/30/19
to jenkinsc...@googlegroups.com
vinoth SS created an issue
 
Jenkins / Bug JENKINS-57772
Build strategy for tags is not working, if you specify ignore tags lesser than 7days
Issue Type: Bug Bug
Assignee: Mark Waite
Components: branch-api-plugin, git-plugin
Created: 2019-05-31 00:07
Priority: Major Major
Reporter: vinoth SS

Build strategy for tags is not working, if you specify ignore tags lesser than 7days

Multibranch pipeline configuration on Automated build tags, Used Build strategy plugin

Added Tags–> Ignore tags older than as 1 (Events : No Automated build is scheduled to trigger)

it works only if you specify as 7 days older.

 

Is this the expected one? shall we have a tags to restrict to build automatically only if that is less than one day too?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ss_vinoth22@yahoo.co.in (JIRA)

unread,
May 30, 2019, 8:09:04 PM5/30/19
to jenkinsc...@googlegroups.com
vinoth SS updated an issue
Change By: vinoth SS
Attachment: Screen Shot 2019-05-31 at 9.00.22.png

ss_vinoth22@yahoo.co.in (JIRA)

unread,
May 30, 2019, 8:11:02 PM5/30/19
to jenkinsc...@googlegroups.com
vinoth SS updated an issue
Change By: vinoth SS
Attachment: Screen Shot 2019-05-31 at 9.09.23.png

ss_vinoth22@yahoo.co.in (JIRA)

unread,
May 30, 2019, 8:13:02 PM5/30/19
to jenkinsc...@googlegroups.com
vinoth SS updated an issue
Build strategy for tags is not working, if you specify ignore tags lesser than 7days

Multibranch pipeline configuration on Automated build tags, Used Build strategy plugin

Added Tags–> Ignore tags older than as 1 (Events : No Automated automatic build is scheduled to trigger triggered for 1.*.*

)

it works only if you specify as 7 days older.
(Anything less than 7 is ignoring automated build trigger for tag)

 

Is this the expected one? shall we have a tags to restrict to build automatically only if that is less than one day too?

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 9:40:02 PM5/30/19
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 9:40:02 PM5/30/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Component/s: basic-branch-build-strategies-plugin
Component/s: branch-api-plugin
Component/s: git-plugin

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:32:01 PM5/30/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-57772
 
Re: Build strategy for tags is not working, if you specify ignore tags lesser than 7days

I am unable to duplicate the problem that you are describing. Please provide instructions to create the job which is showing the failure.

Steps I took attempting to show the failure:

  • Create a multibranch Pipeline job using the GitHub branch source
  • Disable all default behaviors (no branch discovery, no pull request discovery)
  • Add the "Discover tags" behavior
  • Add the build strategy "Tags" with an empty value for Ignore tags newer than
  • Change the "Tags" build strategy Ignore tags older than from its default 7 to 1
  • Run the job, confirm that it selected no tags to be built and no branches to be built (because there have been no tags created on that repository in the last 1 day)

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:34:01 PM5/30/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-57772
I am unable to duplicate the problem that you are describing.  Please provide instructions to create the job which is showing the failure.

Steps I took attempting to show the failure:

* Create a multibranch Pipeline job using the GitHub branch source
* Disable all default behaviors (no branch discovery, no pull request discovery)
* Add the "Discover tags" behavior
* Add the build strategy "Tags" with an empty value for {{Ignore tags newer than}}
* Change the "Tags" build strategy {{Ignore tags older than}} from its default 7 to 1
* Run the job, confirm that it selected no tags to be built and no branches to be built (because there have been no tags created on that repository in the last 1 day)

The job definition I used is uploaded as  [^config.xml]

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:34:02 PM5/30/19
to jenkinsc...@googlegroups.com

ss_vinoth22@yahoo.co.in (JIRA)

unread,
May 30, 2019, 10:36:01 PM5/30/19
to jenkinsc...@googlegroups.com
vinoth SS commented on Bug JENKINS-57772
 
Re: Build strategy for tags is not working, if you specify ignore tags lesser than 7days

when you scan it is not detected tags less than 1 day, but can u create a new tag , It is detected but not triggered automated build.

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:50:03 PM5/30/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-57772
I am unable to duplicate the problem that you are describing.  Please provide instructions to create the job which is showing the failure.

# Steps I took attempting to show the failure:

#
#
Create a multibranch Pipeline job using the GitHub branch source
# Disable all default behaviors (no branch discovery, no pull request discovery)
# Add the "Discover tags" behavior
# Add the build strategy "Tags" with an empty value for {{Ignore tags newer than}}
# Change the "Tags" build strategy {{Ignore tags older than}} from its default 7 to 1
# Run the job, confirm that it selected no tags to be built and no branches to be built (because there have been no tags created on that repository in the last 1 day)


The job definition I used is uploaded as  [^config.xml]

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:50:03 PM5/30/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-57772
I am unable to duplicate the problem that you are describing.  Please provide instructions to create the job which is showing the failure.

# Steps I took attempting to show the failure:

*
#
#
Create a multibranch Pipeline job using the GitHub branch source
* # Disable all default behaviors (no branch discovery, no pull request discovery)
* # Add the "Discover tags" behavior
* # Add the build strategy "Tags" with an empty value for {{Ignore tags newer than}}
* # Change the "Tags" build strategy {{Ignore tags older than}} from its default 7 to 1
* # Run the job, confirm that it selected no tags to be built and no branches to be built (because there have been no tags created on that repository in the last 1 day)


The job definition I used is uploaded as  [^config.xml]

mark.earl.waite@gmail.com (JIRA)

unread,
May 30, 2019, 10:51:02 PM5/30/19
to jenkinsc...@googlegroups.com

I'm not sure I understand your statement.

I added a new tag called 'temp-tag-a' and then clicked the link to scan the repository. The new tag was detected by the scan and a new build was scheduled.

I removed the new tag called 'temp-tag-a' and then clicked the link to scan the repository. The deletion of the tag was detected and the job for temp-tag-a was deleted.

Please provide numbered steps to recreate the problem you are seeing. Others cannot help you if they cannot duplicate the problem you're seeing.

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 3, 2019, 12:50:03 AM6/3/19
to jenkinsc...@googlegroups.com

Steps i tried :

  1. Add the "Discover tags" behavior in multibranch pipeline
  1. Add the build strategy "Tags" with an empty value for Ignore tags newer than
  1. Change the "Tags" build strategy Ignore tags older than from its default 7  to 1
  1.  i have created tags, when you manually scan the organization folder again it is working, but not automatically scanning the events and running the tag job is not happening.
  2. Automated tag job and build ran successfully if you have   Ignore tags older than as its default 7. Then whenever you create tags in Bitbucket , Jenkins events scans automatically and trigger the build as well.

 

hope this is clear...Let me know if im doing anything wrong. Thanks in advance.

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 3, 2019, 3:20:02 AM6/3/19
to jenkinsc...@googlegroups.com
vinoth SS edited a comment on Bug JENKINS-57772
[~markewaite]

Steps i tried :
# Add the "Discover tags" behavior in multibranch pipeline
# Add the build strategy "Tags" with an empty value for {{Ignore tags newer than}}
# Change the "Tags" build strategy {{Ignore tags older than}} from its default 7  to 1
#  i have created tags, when you manually scan the organization folder again it is working, but not automatically scanning the events and running the tag job is not happening.
# Automated tag job and build ran successfully if you have   {{Ignore tags older than as}} its default 7. Then whenever you create tags in Bitbucket , Jenkins events scans automatically and trigger the build as well.


 

hope this is clear...Let me know if im doing anything wrong. Thanks in advance.

mark.earl.waite@gmail.com (JIRA)

unread,
Jun 3, 2019, 10:38:02 PM6/3/19
to jenkinsc...@googlegroups.com

vinoth SS can you also provide the config.xml file from the job that you defined? That will allow comparison with the configuration I'm using successfully.

When you say:

not automatically scanning the events and running the tag job is not happening

I think you mean that the Bitbucket webhook which was registered by the multibranch pipeline is not causing the job to run when a tag is created and pushed to the repository. Is that correct? Were there any other changes pushed to the Bitbucket repository in that time? If the Ignore tags older than is set to 2 instead of 1. does it still behave badly?

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 5, 2019, 1:05:02 AM6/5/19
to jenkinsc...@googlegroups.com

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 5, 2019, 1:06:02 AM6/5/19
to jenkinsc...@googlegroups.com

When you say:

not automatically scanning the events and running the tag job is not happening

I think you mean that the Bitbucket webhook which was registered by the multibranch pipeline is not causing the job to run when a tag is created and pushed to the repository. Is that correct? Were there any other changes pushed to the Bitbucket repository in that time? If the Ignore tags older than is set to 2 instead of 1. does it still behave badly?

 

Yes exactly!! when you create multibranch pipeline is not causing the job to create and run... and there was no other changes has pushed at that time.

Please find the config file attached

config.xml

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 5, 2019, 1:07:02 AM6/5/19
to jenkinsc...@googlegroups.com
vinoth SS edited a comment on Bug JENKINS-57772
When you say:
{quote}not automatically scanning the events and running the tag job is not happening
{quote}
I think you mean that the Bitbucket webhook which was registered by the multibranch pipeline is not causing the job to run when a tag is created and pushed to the repository. Is that correct? Were there any other changes pushed to the Bitbucket repository in that time? If the {{Ignore tags older than}} is set to {{2}} instead of {{1}}. does it still behave badly?

 

{color:#ff8b00} Yes exactly!! when you create multibranch pipeline is not causing the job to create and run... and there was no other changes has pushed at that time. {color}

If the {{Ignore tags older than}} is set to {{2}} instead of {{1}}

{color:#ff8b00}yes it works only when i enter 7, i tried all number from 1-6... It didnt causing the job to run.{color}

Please find the config file attached

[^config.xml]

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 10, 2019, 1:12:02 AM6/10/19
to jenkinsc...@googlegroups.com
vinoth SS edited a comment on Bug JENKINS-57772
[~markewaite]

When you say:
{quote}not automatically scanning the events and running the tag job is not happening
{quote}
I think you mean that the Bitbucket webhook which was registered by the multibranch pipeline is not causing the job to run when a tag is created and pushed to the repository. Is that correct? Were there any other changes pushed to the Bitbucket repository in that time? If the {{Ignore tags older than}} is set to {{2}} instead of {{1}}. does it still behave badly?

 

{color:#ff8b00}Yes exactly!! when you create multibranch pipeline is not causing the job to create and run... and there was no other changes has pushed at that time.{color}

If the {{Ignore tags older than}} is set to {{2}} instead of {{1}}

{color:#ff8b00}yes it works only when i enter 7, i tried all number from 1-6... It didnt causing the job to run.{color}

Please find the config file attached

[^config.xml]

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 16, 2019, 10:39:01 PM6/16/19
to jenkinsc...@googlegroups.com

Mark Waite

i think i guessed it, may be not sure if that is the way this plugin behaves,

 Ignore tags older than   :    how does this work?

  • Created tag less than 7 days?
  • Created tags against Commits less than 7 days?

Because i tried to create tag which has older commit didnt triggered the build? But if i create a new commit and create tag against that which is triggering the tag job and build...

So i guess this works against commit id created less than 7 days.? Correct me if my understanding is wrong?

mark.earl.waite@gmail.com (JIRA)

unread,
Jun 17, 2019, 12:20:03 AM6/17/19
to jenkinsc...@googlegroups.com

Unfortunately, I'm not sure of the precise intent with that strategy, but what you're describing makes sense to me.

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 17, 2019, 12:25:01 AM6/17/19
to jenkinsc...@googlegroups.com

I guess plugin should work by Date of tags created and not the commit-id created. Let me if this needs to be changed?

Because in my scenario developers will create tags once all testing is completed and ready for release to production, by that time this does not build because commit id was created long back, but the tag created against commit id is less than 7 days.

mark.earl.waite@gmail.com (JIRA)

unread,
Jun 17, 2019, 12:33:01 AM6/17/19
to jenkinsc...@googlegroups.com

I haven't done the detailed research to confirm it, but my recollection is that there are two types of tags in git, lightweight tags and tag objects. The strategy may be attempting to handle both cases and thus may be assuming in both cases that the date stamp should be taken from the commit that is the target of the tag. I believe that lightweight tags do not include a separate date. If that was the intent, then using the date of the commit associated with the tag may be how it is intended to work.

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 17, 2019, 1:00:02 AM6/17/19
to jenkinsc...@googlegroups.com

ok do we have any way to get the actual tags created date stamp? I think to use this plugin that date will be an appropriate one?

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 17, 2019, 1:22:02 AM6/17/19
to jenkinsc...@googlegroups.com

i think 

  1. command gives the tag created date 
     
    git for-each-ref --format="%(refname:short) | %(creatordate)" refs/tags/*
  2. Command returns the commit id date for tags

    git log --date-order --graph --tags --simplify-by-decoration --pretty=format:'%ai %h %d'
    Not sure which one plugin uses to analyse the date?

 

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 17, 2019, 1:23:01 AM6/17/19
to jenkinsc...@googlegroups.com
vinoth SS edited a comment on Bug JENKINS-57772
i think 
# command gives the tag created date {color:#ffab00}
 {color}{color:#ffab00}git for-each-ref --format="%(refname:short) | %(creatordate)" refs/tags/*{color}
# {color:#
ffab00}{color:#ffab00}{color:# 172b4d}Command returns the commit id date for tags{color}

{color }{color}
{color
:#ffab00}git log --date-order --graph --tags --simplify-by-decoration --pretty=format:'%ai %h %d'{color}
{color:#172b4d}Not sure which one plugin uses to analyse the date?{color}

 

bitwiseman@gmail.com (JIRA)

unread,
Jun 17, 2019, 2:09:05 PM6/17/19
to jenkinsc...@googlegroups.com

Here is where the plugin tests dates and it uses the "timestamp" of the tag:
https://github.com/jenkinsci/basic-branch-build-strategies-plugin/blob/master/src/main/java/jenkins/branch/buildstrategies/basic/TagBuildStrategyImpl.java#L152

It is up to the the implementers of TagSCMHead to provide that:
https://github.com/jenkinsci/scm-api-plugin/blob/master/src/main/java/jenkins/scm/api/mixin/TagSCMHead.java

The git plugin does what Mark Waite described - use the date of tag creation for annotated tags and the date of the last commit for lightweight tags:
https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitTagSCMHead.java#L37-L38

This comment on SO repeats what Mark Waite said:

There is no date information attached to a lightweight tag. ... The dates in the output of git log --tags --simplify-by-decoration --pretty="format:%ai %d" are the dates of the objects to which the tags point, not the dates when the tags themselves were created.

I think either of the command above would have this same problem, but you'd need to test them to be sure. Further, it is likely that this behavior will differ depending on the underlying branch source - git, github, bitbucket, etc.

ss_vinoth22@yahoo.co.in (JIRA)

unread,
Jun 19, 2019, 9:18:02 PM6/19/19
to jenkinsc...@googlegroups.com

it makes sense, I think we need to create annotated tags would actually trigger the job build automatically.

if people created the lightweight tags, you should note that the tag created date would be last commit date

Note:  date of tag creation for annotated tags and the date of the last commit for lightweight tags:
https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitTagSCMHead.java#L37-L38

Add Comment Add Comment
 
Reply all
Reply to author
Forward
0 new messages