Skip to content
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

Used tag creation timestamp for tag processing #420

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ protected Iterable<BitbucketBranch> create() {
}
if (request.isFetchTags() && !request.isComplete()) {
// Search tags
retrieveTags(request);
retrieveTags(request, event.getTimestamp());
}
} catch (WrappedException e) {
e.unwrap();
Expand Down Expand Up @@ -759,8 +759,9 @@ private void retrieveBranches(final BitbucketSCMSourceRequest request)
request.listener().getLogger().format("%n %d branches were processed%n", count);
}


private void retrieveTags(final BitbucketSCMSourceRequest request)
// tagTimestamp is used to detect the tag event creation time rather then the associated
// commit's time. Relates to JENKINS-57772
private void retrieveTags(final BitbucketSCMSourceRequest request, long tagTimestamp)
throws IOException, InterruptedException {
String fullName = repoOwner + "/" + repository;
request.listener().getLogger().println("Looking up " + fullName + " for tags");
Expand All @@ -774,7 +775,7 @@ private void retrieveTags(final BitbucketSCMSourceRequest request)
for (final BitbucketBranch tag : request.getTags()) {
request.listener().getLogger().println("Checking tag " + tag.getName() + " from " + fullName);
count++;
if (request.process(new BitbucketTagSCMHead(tag.getName(), tag.getDateMillis(), repositoryType), //
if (request.process(new BitbucketTagSCMHead(tag.getName(), (tagTimestamp == 0?tag.getDateMillis():tagTimestamp), repositoryType), //
tag::getRawNode, //
new BitbucketProbeFactory<>(bitbucket, request), //
new BitbucketRevisionFactory<>(bitbucket), //
Expand Down