-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BitbucketTagSCMHead does not receive an annotated tag date #642
Comments
Is this with Bitbucket Cloud or Bitbucket Server? |
On Bitbucket Server, GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags and GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name} return RestTag objects that contain the tag name, tag object ID, and commit ID, but not the tagger date. I don't know whether it is possible to query the tagger date over the REST API, or whether that would require fetching the tag object over the Git protocol (which might then require fetching commit, tree, and blob objects as well). |
On Bitbucket Cloud, GET /2.0/repositories/{workspace}/{repo_slug}/refs/tags/{name} returns the tagger date, too. |
Sorry that was a newb mistake. I am using Bitbucket server. Interesting that the commit date is determined by querying the API. I'll do some research on the API of Bitbucket server. Though I'm pretty familiar with it and I don't think there is a way to get the tag create date without cloning the project. |
Yeah it appears it's not possible in Bitbucket server without cloning. |
I looked at Bitbuckets JIRA issues and found an issue where someone is asking for Bitbucket to support listing tags and getting their create date. I added a comment to it and linked it to this issue. |
#420 looks related, but it uses the timestamp of the Bitbucket webhook event that triggered the scan; that might not be the same as the timestamp within the Git annotated tag object. |
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
Controller: ubuntu 1804
Agent: ubuntu 1804
Reproduction steps
Organization Folder
to scan the created Bitbucket project, configureFilter by ref age
discovery trait, to filter tags created after 1 days. (Remember to enableDiscover Tags
)git tag -m "" v0.0.0
) from a commit that is older than 1 day and push the tag. Click theScan Multibranch Pipeline Now
button in the repository folder. View the logs inScan Multibranch Pipeline Log
.Expected Results
When the
Scan Multibranch Pipeline
job runs it should not skip annotated tags that were created less than a day ago where the commit is older than a day.Actual Results
The
bitbucket-branch-source-plugin
plugin is not providing the annotated tags create date and instead the commits date to theBitbucketTagSCMHead
constructor.Anything else?
As per
GitTagSCMHead
class whichBitbucketTagSCMHead
extends.The
timestamp
parameter to theGitTagSCMHead
constructor should be...Source: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitTagSCMHead.java#L46-L47
I've spent a day trying to understand this plugins code and I found where the
BitbucketTagSCMHead
is being constructed but I can't tell how the timestamp value is generated.Source: https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java#L805.
There is a TODO in the code that mentions supporting this, but I have no Idea if it's related or how we would add that support.
Source: https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/filesystem/BitbucketSCMFileSystem.java#L75-L84
If someone could help me understand this a little better I may be able to produce the fix myself.
The text was updated successfully, but these errors were encountered: