Skip to content

Commit b6c57cc

Browse files
committed
Add a management endpoint to refresh fix versions
if needed...
1 parent a4ecaed commit b6c57cc

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/main/java/org/hibernate/infra/replicate/jira/service/jira/HandlerProjectContext.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,17 @@ public JiraVersion fixVersion(JiraVersion version) {
264264
}
265265
}
266266

267+
public void refreshFixVersions() {
268+
versionLock.lock();
269+
try {
270+
destFixVersions.clear();
271+
destFixVersions.putAll(getAndCreateMissingCurrentFixVersions(project, projectGroupContext, sourceJiraClient,
272+
destinationJiraClient));
273+
} finally {
274+
versionLock.unlock();
275+
}
276+
}
277+
267278
private static Map<String, JiraVersion> getAndCreateMissingCurrentFixVersions(JiraConfig.JiraProject project,
268279
HandlerProjectGroupContext projectGroupContext, JiraRestClient sourceJiraClient,
269280
JiraRestClient destinationJiraClient) {

src/main/java/org/hibernate/infra/replicate/jira/service/jira/JiraService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ public void registerManagementRoutes(@Observes ManagementInterface mi) {
256256
triggerCommentSyncEvents(project, null, comments);
257257
rc.end();
258258
});
259+
mi.router().get("/sync/fix-versions/:project").blockingHandler(rc -> {
260+
String project = rc.pathParam("project");
261+
262+
HandlerProjectContext context = contextPerProject.get(project);
263+
264+
if (context == null) {
265+
throw new IllegalArgumentException("Unknown project '%s'".formatted(project));
266+
}
267+
268+
context.submitTask(context::refreshFixVersions);
269+
rc.end();
270+
});
259271
}
260272

261273
/**

0 commit comments

Comments
 (0)