Skip to content
Snippets Groups Projects
Commit f19eee2b authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/main/1.0.0-mig' into 'main'

Update API to use 1.0.0 RC SDK and Quarkus 3.8.x

See merge request !188
parents 907dc7f2 cdf33208
No related branches found
No related tags found
1 merge request!188Update API to use 1.0.0 RC SDK and Quarkus 3.8.x
Pipeline #44265 failed
Showing
with 70 additions and 75 deletions
......@@ -15,10 +15,10 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.2.11.Final</quarkus.platform.version>
<quarkus.platform.version>3.8.3</quarkus.platform.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<eclipse-api-version>0.9.6</eclipse-api-version>
<eclipse-api-version>1.0.0-RC1</eclipse-api-version>
<auto-value.version>1.10.4</auto-value.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<sonar.sources>src/main</sonar.sources>
......
......@@ -16,8 +16,8 @@ import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.namespace.DefaultUrlParameterNames;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.http.namespace.DefaultUrlParameterNames;
import org.eclipsefoundation.persistence.dto.BareNode;
import org.eclipsefoundation.persistence.dto.filter.DtoFilter;
import org.eclipsefoundation.persistence.model.DtoTable;
......
......@@ -15,6 +15,15 @@ import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.persistence.dto.BareNode;
import org.eclipsefoundation.persistence.dto.filter.DtoFilter;
import org.eclipsefoundation.persistence.model.DtoTable;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatement;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatementBuilder;
import org.eclipsefoundation.utils.helper.DateTimeHelper;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import jakarta.persistence.Entity;
......@@ -24,15 +33,6 @@ import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.helper.DateTimeHelper;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.persistence.dto.BareNode;
import org.eclipsefoundation.persistence.dto.filter.DtoFilter;
import org.eclipsefoundation.persistence.model.DtoTable;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatement;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatementBuilder;
/**
* Tracking for github installation data for GH ECA applications used for requesting data and updating commit statuses.
*/
......
......@@ -15,11 +15,11 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import org.eclipsefoundation.core.exception.ApplicationException;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.git.eca.model.Commit;
import org.eclipsefoundation.git.eca.model.ValidationRequest;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.http.exception.ApplicationException;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import io.undertow.util.HexConverter;
......@@ -62,8 +62,7 @@ public class CommitHelper {
}
public static MultivaluedMap<String, String> getCommitParams(ValidationRequest req, String projectId) {
return getCommitParams(req.getCommits().stream().map(Commit::getHash).toList(), projectId,
req.getRepoUrl().toString());
return getCommitParams(req.getCommits().stream().map(Commit::getHash).toList(), projectId, req.getRepoUrl().toString());
}
public static MultivaluedMap<String, String> getCommitParams(List<String> commitShas, String projectId, String repoUrl) {
......@@ -77,9 +76,8 @@ public class CommitHelper {
}
/**
* Generates a request fingerprint for looking up requests that have already been processed in the past. Collision here
* is extremely unlikely, and low risk on the change it does. For that reason, a more secure but heavier hashing alg.
* wasn't chosen.
* Generates a request fingerprint for looking up requests that have already been processed in the past. Collision here is extremely
* unlikely, and low risk on the change it does. For that reason, a more secure but heavier hashing alg. wasn't chosen.
*
* @param req the request to generate a fingerprint for
* @return the fingerprint for the request
......@@ -96,8 +94,7 @@ public class CommitHelper {
}
/**
* Centralized way of retrieving a checked project ID from a project for use when interacting with commits and commit
* data.
* Centralized way of retrieving a checked project ID from a project for use when interacting with commits and commit data.
*
* @param p the current project to attempt to retrieve an ID from
* @return the project ID or the given default (empty string).
......
......@@ -22,9 +22,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.helper.DateTimeHelper;
import org.eclipsefoundation.core.helper.TransformationHelper;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.core.service.APIMiddleware;
import org.eclipsefoundation.git.eca.api.GithubAPI;
import org.eclipsefoundation.git.eca.api.models.GithubCommit;
......@@ -45,9 +42,12 @@ import org.eclipsefoundation.git.eca.namespace.ProviderType;
import org.eclipsefoundation.git.eca.service.GithubApplicationService;
import org.eclipsefoundation.git.eca.service.ValidationService;
import org.eclipsefoundation.git.eca.service.ValidationStatusService;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.eclipsefoundation.persistence.dao.PersistenceDao;
import org.eclipsefoundation.persistence.model.RDBMSQuery;
import org.eclipsefoundation.persistence.service.FilterService;
import org.eclipsefoundation.utils.helper.DateTimeHelper;
import org.eclipsefoundation.utils.helper.TransformationHelper;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
......@@ -16,7 +16,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.service.CachingService;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.efservices.api.models.InterestGroup;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.efservices.api.models.Project.GithubProject;
......@@ -144,7 +144,6 @@ public final class ProjectHelper {
.setWebsiteRepo(Collections.emptyList())
.setGitlab(ig.getGitlab())
.setGithub(GithubProject.builder().setOrg("").setIgnoredRepos(Collections.emptyList()).build())
.setWorkingGroups(Collections.emptyList())
.setIndustryCollaborations(Collections.emptyList())
.setReleases(Collections.emptyList())
.setTopLevelProject("")
......@@ -166,8 +165,7 @@ public final class ProjectHelper {
* @return true if the project is a match via Gitlab repos or project namespace, false otherwise
*/
private boolean doesProjectMatchGitlabRepos(Project p, String repoUrl, String projectNamespace) {
return p.getGitlabRepos().stream().anyMatch(re -> re.getUrl() != null && re.getUrl().endsWith(repoUrl))
|| (projectNamespace.startsWith(p.getGitlab().getProjectGroup() + "/")
return (projectNamespace.startsWith(p.getGitlab().getProjectGroup() + "/")
&& p.getGitlab().getIgnoredSubGroups().stream().noneMatch(sg -> projectNamespace.startsWith(sg + "/")));
}
......
......@@ -14,9 +14,9 @@ package org.eclipsefoundation.git.eca.namespace;
import java.util.Arrays;
import java.util.List;
import jakarta.inject.Singleton;
import org.eclipsefoundation.utils.namespace.UrlParameterNamespace;
import org.eclipsefoundation.core.namespace.UrlParameterNamespace;
import jakarta.inject.Singleton;
@Singleton
public final class GitEcaParameterNames implements UrlParameterNamespace {
......
......@@ -13,14 +13,14 @@ package org.eclipsefoundation.git.eca.resource;
import java.util.Arrays;
import org.eclipsefoundation.core.helper.DateTimeHelper;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.api.models.EclipseUser;
import org.eclipsefoundation.git.eca.dto.GithubWebhookTracking;
import org.eclipsefoundation.git.eca.service.UserService;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.eclipsefoundation.persistence.dao.PersistenceDao;
import org.eclipsefoundation.persistence.model.RDBMSQuery;
import org.eclipsefoundation.persistence.service.FilterService;
import org.eclipsefoundation.utils.helper.DateTimeHelper;
import io.quarkus.security.identity.SecurityIdentity;
import io.smallrye.jwt.auth.principal.DefaultJWTCallerPrincipal;
......
......@@ -16,7 +16,6 @@ import java.util.List;
import java.util.Optional;
import org.apache.http.HttpStatus;
import org.eclipsefoundation.core.helper.TransformationHelper;
import org.eclipsefoundation.git.eca.api.models.GithubWebhookRequest;
import org.eclipsefoundation.git.eca.api.models.GithubWebhookRequest.PullRequest;
import org.eclipsefoundation.git.eca.dto.GithubWebhookTracking;
......@@ -28,6 +27,7 @@ import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.namespace.HCaptchaErrorCodes;
import org.eclipsefoundation.git.eca.namespace.WebhookHeaders;
import org.eclipsefoundation.git.eca.service.GithubApplicationService;
import org.eclipsefoundation.utils.helper.TransformationHelper;
import org.jboss.resteasy.annotations.jaxrs.HeaderParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
......@@ -13,6 +13,13 @@ package org.eclipsefoundation.git.eca.resource;
import java.time.LocalDate;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.git.eca.config.EcaReportsConfig;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.service.ReportsService;
import org.eclipsefoundation.http.model.RequestWrapper;
import io.quarkus.security.UnauthorizedException;
import jakarta.inject.Inject;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.GET;
......@@ -20,13 +27,6 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.exception.UnauthorizedException;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.config.EcaReportsConfig;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.service.ReportsService;
@Path("/reports")
public class ReportsResource {
@Inject
......
......@@ -17,15 +17,15 @@ import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.exception.FinalForbiddenException;
import org.eclipsefoundation.core.helper.TransformationHelper;
import org.eclipsefoundation.core.service.CachingService;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.git.eca.api.models.EclipseUser;
import org.eclipsefoundation.git.eca.helper.ProjectHelper;
import org.eclipsefoundation.git.eca.model.ValidationRequest;
import org.eclipsefoundation.git.eca.model.ValidationResponse;
import org.eclipsefoundation.git.eca.namespace.APIStatusCode;
import org.eclipsefoundation.git.eca.service.ValidationService;
import org.eclipsefoundation.utils.exception.FinalForbiddenException;
import org.eclipsefoundation.utils.helper.TransformationHelper;
import org.jboss.resteasy.annotations.jaxrs.QueryParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
......@@ -11,16 +11,11 @@
**********************************************************************/
package org.eclipsefoundation.git.eca.resource;
import jakarta.inject.Inject;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.api.models.SystemHook;
import org.eclipsefoundation.git.eca.namespace.EventType;
import org.eclipsefoundation.git.eca.namespace.WebhookHeaders;
import org.eclipsefoundation.git.eca.service.SystemHookService;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.jboss.resteasy.annotations.jaxrs.HeaderParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -28,6 +23,11 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.inject.Inject;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
@Path("webhooks/gitlab")
public class WebhooksResource {
private static final Logger LOGGER = LoggerFactory.getLogger(WebhooksResource.class);
......
......@@ -14,8 +14,8 @@ package org.eclipsefoundation.git.eca.service;
import java.time.LocalDate;
import java.util.List;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.model.PrivateProjectData;
import org.eclipsefoundation.http.model.RequestWrapper;
/**
* This interface provides the means to get list of desired entities from the DB
......
......@@ -11,8 +11,8 @@
**********************************************************************/
package org.eclipsefoundation.git.eca.service;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.api.models.SystemHook;
import org.eclipsefoundation.http.model.RequestWrapper;
/**
* Processes the various system hooks received.
......
......@@ -11,9 +11,9 @@
**********************************************************************/
package org.eclipsefoundation.git.eca.service;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.model.ValidationRequest;
import org.eclipsefoundation.git.eca.model.ValidationResponse;
import org.eclipsefoundation.http.model.RequestWrapper;
/**
* Service containing logic for validating commits.
......
......@@ -13,11 +13,11 @@ package org.eclipsefoundation.git.eca.service;
import java.util.List;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.git.eca.dto.CommitValidationStatus;
import org.eclipsefoundation.git.eca.model.ValidationRequest;
import org.eclipsefoundation.git.eca.model.ValidationResponse;
import org.eclipsefoundation.http.model.RequestWrapper;
/**
* Interface for retrieving/updating validation statuses.
......
......@@ -19,8 +19,8 @@ import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.model.CacheWrapper;
import org.eclipsefoundation.core.service.CachingService;
import org.eclipsefoundation.caching.model.CacheWrapper;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.efservices.services.DrupalTokenService;
import org.eclipsefoundation.git.eca.api.AccountsAPI;
......
......@@ -19,19 +19,11 @@ import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.MultivaluedMap;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.exception.ApplicationException;
import org.eclipsefoundation.core.model.FlatRequestWrapper;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.core.service.APIMiddleware;
import org.eclipsefoundation.core.service.CachingService;
import org.eclipsefoundation.git.eca.api.GithubAPI;
import org.eclipsefoundation.git.eca.api.models.GithubWebhookRequest.PullRequest;
import org.eclipsefoundation.git.eca.config.WebhooksConfig;
......@@ -39,6 +31,9 @@ import org.eclipsefoundation.git.eca.dto.GithubApplicationInstallation;
import org.eclipsefoundation.git.eca.helper.JwtHelper;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.service.GithubApplicationService;
import org.eclipsefoundation.http.exception.ApplicationException;
import org.eclipsefoundation.http.model.FlatRequestWrapper;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.eclipsefoundation.persistence.dao.PersistenceDao;
import org.eclipsefoundation.persistence.model.RDBMSQuery;
import org.eclipsefoundation.persistence.service.FilterService;
......@@ -49,6 +44,11 @@ import org.slf4j.LoggerFactory;
import com.github.benmanes.caffeine.cache.AsyncLoadingCache;
import com.github.benmanes.caffeine.cache.Caffeine;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.MultivaluedMap;
/**
* Default caching implementation of the GH app service. This uses a loading cache to keep installation info highly
* available to reduce latency in calls.
......
......@@ -16,12 +16,12 @@ import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.git.eca.dto.PrivateProjectEvent;
import org.eclipsefoundation.git.eca.model.PrivateProjectData;
import org.eclipsefoundation.git.eca.model.mappers.PrivateProjectEventMapper;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.service.ReportsService;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.eclipsefoundation.persistence.dao.PersistenceDao;
import org.eclipsefoundation.persistence.model.RDBMSQuery;
import org.eclipsefoundation.persistence.service.FilterService;
......
......@@ -19,19 +19,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.control.ActivateRequestContext;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.core.MultivaluedMap;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.model.CacheWrapper;
import org.eclipsefoundation.core.model.RequestWrapper;
import org.eclipsefoundation.core.service.CachingService;
import org.eclipsefoundation.caching.model.CacheWrapper;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.git.eca.api.GitlabAPI;
import org.eclipsefoundation.git.eca.api.models.GitlabProjectResponse;
import org.eclipsefoundation.git.eca.api.models.GitlabUserResponse;
......@@ -39,6 +30,7 @@ import org.eclipsefoundation.git.eca.api.models.SystemHook;
import org.eclipsefoundation.git.eca.dto.PrivateProjectEvent;
import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
import org.eclipsefoundation.git.eca.service.SystemHookService;
import org.eclipsefoundation.http.model.RequestWrapper;
import org.eclipsefoundation.persistence.dao.PersistenceDao;
import org.eclipsefoundation.persistence.model.RDBMSQuery;
import org.eclipsefoundation.persistence.service.FilterService;
......@@ -46,6 +38,14 @@ import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.control.ActivateRequestContext;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.core.MultivaluedMap;
@ApplicationScoped
@ActivateRequestContext
public class DefaultSystemHookService implements SystemHookService {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment