Skip to content

Commit badd32c

Browse files
authored
[JENKINS-76190] Error retrieving tag timestamp from webhook event (#1142)
Use toHash if fromHash is valued with null hash (0000000000000000000000000000000000000000) on data center TAG event
1 parent 882341b commit badd32c

File tree

2 files changed

+18
-1
lines changed
  • src/main
    • java/com/cloudbees/jenkins/plugins/bitbucket/impl/webhook/server
    • resources/com/cloudbees/jenkins/plugins/bitbucket/endpoints/BitbucketEndpointConfiguration

2 files changed

+18
-1
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/webhook/server/ServerPushEvent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public boolean equals(Object obj) {
103103

104104
// event logs with the name of the processor
105105
private static final Logger LOGGER = Logger.getLogger(ServerPushWebhookProcessor.class.getName());
106+
private static final String NULL_HASH = "0000000000000000000000000000000000000000";
106107

107108
private final BitbucketServerRepository repository;
108109
private final BitbucketServerCommit refCommit;
@@ -160,7 +161,7 @@ private void addBranchesAndTags(BitbucketSCMSource src, Map<SCMHead, SCMRevision
160161
break;
161162
}
162163
case "DELETE": {
163-
tagHash = change.getFromHash();
164+
tagHash = !NULL_HASH.equals(change.getFromHash()) ? change.getFromHash() : change.getToHash();
164165
break;
165166
}
166167
default:

src/main/resources/com/cloudbees/jenkins/plugins/bitbucket/endpoints/BitbucketEndpointConfiguration/config.jelly

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
Copyright 2024 Nikolas Falco
3+
4+
Licensed under the Apache License, Version 2.0 (the
5+
"License"); you may not use this file except in compliance
6+
with the License. You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing,
11+
software distributed under the License is distributed on an
12+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
KIND, either express or implied. See the License for the
14+
specific language governing permissions and limitations
15+
under the License.
16+
-->
117
<?jelly escape-by-default='true'?>
218
<j:jelly xmlns:j="jelly:core"
319
xmlns:f="/lib/form">

0 commit comments

Comments
 (0)