Browse Source

Give up on using PNC rest client for now roll our own

There is incompatibility between resteasy in quarkus (6.x) to the one
used in PNC (3.x), the API design has changed quite a bit and it seems
impossible to have both exist on the classpath at the same time.

For the one endpoint we need (Build) then our own restclient should do
12-add-pnc-build-support
Jonathan Christison 3 years ago
parent
commit
87f45b8329
  1. 33
      pom.xml
  2. 16
      src/main/java/com/redhat/pctsec/model/PNCBuild.java
  3. 12
      src/main/java/com/redhat/pctsec/model/api/service/AltPncService.java

33
pom.xml

@ -96,42 +96,15 @@
<groupId>org.jboss.pnc</groupId>
<artifactId>rest-client</artifactId>
<version>2.5.1</version>
<!--
<exclusions>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<!--
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.2.4.Final</version>
</dependency>
-->
<!--https://groups.google.com/g/quarkus-dev/c/IuicocvL3g8-->
<!--
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>-->
<!--
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
</dependency>
-->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.34</version>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>

16
src/main/java/com/redhat/pctsec/model/PNCBuild.java

@ -1,9 +1,14 @@
package com.redhat.pctsec.model;
import com.redhat.pctsec.model.api.service.PncService;
import com.redhat.pctsec.model.api.service.AltPncService;
//import com.redhat.pctsec.model.api.service.PncService;
import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.persistence.Entity;
import jakarta.persistence.Transient;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.pnc.dto.Build;
import java.net.URI;
@ -13,8 +18,16 @@ import java.net.URL;
public class PNCBuild extends BuildType{
@Transient
public static final String apiUrl = ConfigProvider.getConfig().getValue("pnc.api-url",String.class);
@Transient
private static final AltPncService pnc = QuarkusRestClientBuilder.newBuilder().baseUri(URI.create(apiUrl)).build(AltPncService.class);
/*
@Transient
PncService pnc;
*/
@Transient
Build build;
@ -33,7 +46,6 @@ public class PNCBuild extends BuildType{
public PNCBuild(String buildRef) {
super(buildRef);
this.pnc = new PncService();
}
@Override

12
src/main/java/com/redhat/pctsec/model/api/service/AltPncService.java

@ -0,0 +1,12 @@
package com.redhat.pctsec.model.api.service;
import jakarta.ws.rs.*;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.jboss.pnc.dto.Build;
@Path("pnc-rest/v2/builds")
@RegisterRestClient
public interface AltPncService {
@GET
@Path("{id}")
Build getBuild(@PathParam("id") String id);
}
Loading…
Cancel
Save