Skip to content

Commit

Permalink
Merge pull request #2 from rnc/BR1
Browse files Browse the repository at this point in the history
Correct pom/gh-actions. Add Indy clients
  • Loading branch information
rnc authored Dec 5, 2024
2 parents 9d7eb7d + aefff14 commit f9d2037
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
build:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif
# if: github.repository == 'pnc/konflux-build-konflux-build-driver' && github.event_name == 'pull_request'
if: github.repository == 'project-ncl/konflux-build-driver' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
verbose: true

snapshot:
if: github.repository == 'pnc/konflux-build-konflux-build-driver' && github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.repository == 'project-ncl/konflux-build-driver' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -65,7 +65,7 @@ jobs:
java-version: 21
# https://github.com/marketplace/actions/maven-setings-action
- name: Maven Settings
uses: s4u/maven-settings-action@v3.0.0
uses: s4u/maven-settings-action@v3.1.0
with:
sonatypeSnapshots: true
githubServer: false
Expand All @@ -76,4 +76,4 @@ jobs:
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- name: Deploy Snapshot
run: mvn -B -V org.apache.maven.plugins:maven-source-plugin:jar-no-fork deploy
run: mvn -B -V -Pjboss-release org.apache.maven.plugins:maven-source-plugin:jar-no-fork deploy
73 changes: 69 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

<name>Konflux Build Driver</name>
<description>PNC Build Driver for Konflux</description>
<url>https://github.com/pnc/konflux-build-driver</url>
<url>https://github.com/project-ncl/konflux-build-driver</url>
<scm>
<connection>scm:git:https://github.com/pnc/konflux-build-driver.git</connection>
<developerConnection>scm:git:[email protected]:pnc/konflux-build-driver.git</developerConnection>
<url>https://github.com/pnc/konflux-build-driver</url>
<connection>scm:git:https://github.com/project-ncl/konflux-build-driver.git</connection>
<developerConnection>scm:git:[email protected]:project-ncl/konflux-build-driver.git</developerConnection>
<url>https://github.com/project-ncl/konflux-build-driver</url>
<tag>HEAD</tag>
</scm>
<licenses>
Expand All @@ -43,9 +43,21 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<jboss.releases.repo.id>sonatype-nexus-staging</jboss.releases.repo.id>
<jboss.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</jboss.releases.repo.url>
<jboss.snapshots.repo.id>sonatype-nexus-snapshots</jboss.snapshots.repo.id>
<jboss.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</jboss.snapshots.repo.url>

<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.17.3</quarkus.platform.version>

<lombok.version>1.18.32</lombok.version>
<formatter-maven-plugin.version>2.24.1</formatter-maven-plugin.version>
<impsort-maven-plugin.version>1.12.0</impsort-maven-plugin.version>

<format.skip>false</format.skip>
</properties>

<dependencyManagement>
Expand All @@ -61,6 +73,26 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down Expand Up @@ -90,6 +122,39 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>${formatter-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-ide-config</artifactId>
<version>${quarkus.platform.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/formatter-maven-plugin-${formatter-maven-plugin.version}</cachedir>
<configFile>eclipse-format.xml</configFile>
<lineEnding>LF</lineEnding>
<skip>${format.skip}</skip>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>${impsort-maven-plugin.version}</version>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/impsort-maven-plugin-${impsort-maven-plugin.version}</cachedir>
<groups>java.,javax.,jakarta.,org.,com.</groups>
<staticGroups>*</staticGroups>
<lineEnding>LF</lineEnding>
<skip>${format.skip}</skip>
<removeUnused>true</removeUnused>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.jboss.pnc.konfluxbuilddriver.clients;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

/**
* Indy service representing the Indy server. It uses Quarkus magical rest client to generate the client implementation
*/
@RegisterRestClient(configKey = "indy-service")
public interface IndyService {

/**
* Ask Indy to give us the token that we will use for Maven communication with Indy, in the builder pod for the
* particular buildId
*
* @param indyTokenRequestDTO the DTO to send to Indy
* @param accessToken accessToken required to send data. Note that it should include "Bearer <token>"
*
* @return Token DTO
*/
@Path("/api/security/auth/token")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@POST
IndyTokenResponseDTO getAuthToken(
IndyTokenRequestDTO indyTokenRequestDTO,
@HeaderParam("Authorization") String accessToken);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.jboss.pnc.konfluxbuilddriver.clients;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;

/**
* DTO of the Indy token endpoint request
*/
@Builder
public record IndyTokenRequestDTO(@JsonProperty("build-id") String buildId) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jboss.pnc.konfluxbuilddriver.clients;

import lombok.Builder;

/**
* DTO of the Indy token endpoint response
*/
@Builder
public record IndyTokenResponseDTO(String token) {

}

0 comments on commit f9d2037

Please sign in to comment.