Skip to content

Commit d393a60

Browse files
committed
Merge branch 'release/7.1.0'
2 parents 9db79e2 + ecb9b0f commit d393a60

27 files changed

+392
-230
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.gradle
2-
/build/
2+
build
33
bin/
44

55
# Ignore Gradle GUI config
@@ -15,7 +15,6 @@ gradle-app.setting
1515
# gradle/wrapper/gradle-wrapper.properties
1616

1717
HELP.md
18-
.gradle
1918
build/
2019
!gradle/wrapper/gradle-wrapper.jar
2120
!**/src/main/**

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM openjdk:11.0.3-jre-slim
1+
FROM openjdk:11.0.15-jre-slim
22

3-
ARG spring_boot_jar
3+
ARG jar
44

5-
RUN test -n "$spring_boot_jar"
5+
RUN test -n "$jar"
66

7-
COPY $spring_boot_jar iexec-result-proxy.jar
7+
COPY $jar iexec-result-proxy.jar
88

99
# For Spring-Boot project, use the entrypoint
1010
# below to reduce Tomcat startup time.

Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@Library('global-jenkins-library@1.3.0') _
1+
@Library('global-jenkins-library@2.0.1') _
22
buildJavaProject(
3+
buildInfo: getBuildInfo(),
34
integrationTestsEnvVars: [],
45
shouldPublishJars: true,
56
shouldPublishDockerImages: true,
67
dockerfileDir: '.',
7-
//dockerfileFilename: "Dockerfile-local",
8-
buildContext: '.',
9-
//dockerImageRepositoryName: '',
8+
preDevelopVisibility: 'iex.ec',
9+
developVisibility: 'iex.ec',
1010
preProductionVisibility: 'docker.io',
1111
productionVisibility: 'docker.io')

build.gradle

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '2.2.5.RELEASE'
3+
id 'org.springframework.boot' version '2.6.2'
44
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
55
id 'eclipse'
66
id 'jacoco'
77
id 'org.sonarqube' version '3.3'
88
id 'maven-publish'
99
}
1010

11-
group = 'com.iexec.result-proxy'
12-
sourceCompatibility = 11
13-
targetCompatibility = 11
11+
ext {
12+
springCloudVersion = '2021.0.0'
13+
gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
14+
}
15+
16+
allprojects {
17+
group = 'com.iexec.result-proxy'
18+
sourceCompatibility = 11
19+
targetCompatibility = 11
1420

15-
repositories {
16-
mavenLocal()
17-
mavenCentral()
18-
maven {
19-
url 'https://nexus.iex.ec/repository/maven-public/'
21+
if (gitBranch != 'main' && gitBranch != 'master' && !(gitBranch ==~ '(release|hotfix|support)/.*')) {
22+
version += '-NEXT-SNAPSHOT'
2023
}
21-
maven {
22-
url 'https://jitpack.io'
24+
25+
repositories {
26+
mavenLocal()
27+
mavenCentral()
28+
maven {
29+
url 'https://nexus.intra.iex.ec/repository/maven-public/'
30+
}
31+
maven {
32+
url 'https://jitpack.io'
33+
}
2334
}
2435
}
2536

@@ -29,10 +40,6 @@ configurations {
2940
}
3041
}
3142

32-
ext {
33-
set('springCloudVersion', 'Hoxton.SR3')
34-
}
35-
3643
dependencies {
3744
// iexec
3845
implementation "com.iexec.common:iexec-common:${iexecCommonVersion}"
@@ -45,6 +52,7 @@ dependencies {
4552
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
4653
implementation 'org.springframework.boot:spring-boot-starter-web'
4754
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
55+
implementation "org.springframework.retry:spring-retry"
4856

4957
// test
5058
testImplementation('org.springframework.boot:spring-boot-starter-test') {
@@ -57,9 +65,8 @@ dependencies {
5765
compileOnly 'org.projectlombok:lombok'
5866
annotationProcessor 'org.projectlombok:lombok'
5967

60-
// swagger
61-
implementation 'io.springfox:springfox-swagger2:2.9.2'
62-
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
68+
// Spring Doc
69+
implementation 'org.springdoc:springdoc-openapi-ui:1.6.3'
6370

6471
// ipfs
6572
implementation 'com.github.ipfs:java-ipfs-http-client:1.3.3'
@@ -77,6 +84,10 @@ dependencyManagement {
7784
}
7885
}
7986

87+
springBoot {
88+
buildInfo()
89+
}
90+
8091
test {
8192
useJUnitPlatform()
8293
}
@@ -100,21 +111,6 @@ jacocoTestReport {
100111
tasks.test.finalizedBy tasks.jacocoTestReport
101112
tasks.sonarqube.dependsOn tasks.jacocoTestReport
102113

103-
// ######################
104-
// # create version #
105-
// ######################
106-
107-
task createVersion (type: Exec) {
108-
description 'Set version in application.yml'
109-
commandLine('sh', '-c', "sed -i 's/^version.*/version: ${version}/' src/main/resources/application.yml")
110-
}
111-
112-
compileJava.dependsOn createVersion
113-
114-
// ######################
115-
// # upload archive #
116-
// ######################
117-
118114
publishing {
119115
publications {
120116
maven(MavenPublication) {
@@ -133,14 +129,14 @@ publishing {
133129
}
134130
}
135131

136-
ext.bootJarPath = relativePath(tasks.bootJar.outputs.files.singleFile)
132+
ext.jarPathForOCI = relativePath(tasks.bootJar.outputs.files.singleFile)
137133
ext.gitShortCommit = 'git rev-parse --short=8 HEAD'.execute().text.trim()
138134
ext.ociImageName = 'local/' + ['bash', '-c', 'basename $(git config --get remote.origin.url) .git'].execute().text.trim()
139135

140136
task buildImage(type: Exec) {
141137
group 'Build'
142138
description 'Builds an OCI image from a Dockerfile.'
143139
dependsOn tasks.bootJar
144-
commandLine ("sh", "-c", "docker build --build-arg spring_boot_jar=$bootJarPath -t $ociImageName:$gitShortCommit ."
140+
commandLine ("sh", "-c", "docker build --build-arg jar=$jarPathForOCI -t $ociImageName:$gitShortCommit ."
145141
+ " && docker tag $ociImageName:$gitShortCommit $ociImageName:dev")
146142
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=7.0.2
2-
iexecCommonVersion=5.9.1
1+
version=7.1.0
2+
iexecCommonVersion=6.0.0
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
plugins {
2+
id 'java-library'
3+
id 'jacoco'
4+
id 'maven-publish'
5+
}
6+
7+
dependencies {
8+
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
9+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
10+
}
11+
12+
java {
13+
withJavadocJar()
14+
withSourcesJar()
15+
}
16+
17+
test {
18+
useJUnitPlatform()
19+
}
20+
21+
jacoco {
22+
toolVersion = "0.8.7"
23+
}
24+
// sonarqube code coverage requires jacoco XML report
25+
jacocoTestReport {
26+
reports {
27+
xml.enabled true
28+
}
29+
}
30+
tasks.test.finalizedBy tasks.jacocoTestReport
31+
32+
publishing {
33+
publications {
34+
maven(MavenPublication) {
35+
from components.java
36+
}
37+
}
38+
repositories {
39+
maven {
40+
credentials {
41+
username project.hasProperty("nexusUser")? project.nexusUser: ''
42+
password project.hasProperty("nexusPassword")? project.nexusPassword: ''
43+
}
44+
url = project.hasProperty("nexusUrl")? project.nexusUrl: ''
45+
}
46+
}
47+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2022 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* 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, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.api;
18+
19+
import com.iexec.common.chain.eip712.entity.EIP712Challenge;
20+
import com.iexec.common.result.ResultModel;
21+
import feign.Headers;
22+
import feign.Param;
23+
import feign.RequestLine;
24+
import feign.Response;
25+
26+
/**
27+
* Interface allowing to instantiate a Feign client targeting Result Proxy REST endpoints.
28+
* <p>
29+
* To create the client, see the related builder.
30+
* @see ResultProxyClientBuilder
31+
*/
32+
public interface ResultProxyClient {
33+
34+
@RequestLine("GET /results/challenge?chainId={chainId}")
35+
EIP712Challenge getChallenge(@Param("chainId") int chainId);
36+
37+
@RequestLine("POST /results/login?chainId={chainId}")
38+
String login(@Param("chainId") int chainId, String token);
39+
40+
@RequestLine("POST /")
41+
@Headers("Authorization: {authorization}")
42+
String addResult(
43+
@Param("authorization") String authorization,
44+
ResultModel model
45+
);
46+
47+
@RequestLine("HEAD /results/{chainTaskId}")
48+
@Headers("Authorization: {authorization}")
49+
String isResultUploaded(
50+
@Param("authorization") String authorization,
51+
@Param("chainTaskId") String chainTaskId
52+
);
53+
54+
@RequestLine("GET /results/{chainTaskId}?chainId={chainId}")
55+
@Headers({"Accept: application/zip", "Authorization: {authorization}"})
56+
Response getResult(
57+
@Param("chainTaskId") String chainTaskId,
58+
@Param("authorization") String token,
59+
@Param("chainId") int chainId
60+
);
61+
62+
@RequestLine("GET /results/{chainTaskId}/ipfshash")
63+
String getIpfsHashForTask(@Param("chainTaskId") String chainTaskId);
64+
65+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2022 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* 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, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.api;
18+
19+
import com.iexec.common.utils.FeignBuilder;
20+
import feign.Logger;
21+
22+
/**
23+
* Creates Feign client instances to query REST endpoints described in {@link ResultProxyClient}.
24+
* @see FeignBuilder
25+
*/
26+
public class ResultProxyClientBuilder {
27+
28+
private ResultProxyClientBuilder() {}
29+
30+
public static ResultProxyClient getInstance(Logger.Level logLevel, String url) {
31+
return FeignBuilder.createBuilder(logLevel)
32+
.target(ResultProxyClient.class, url);
33+
}
34+
35+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2022 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* 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, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.api;
18+
19+
import feign.Logger;
20+
import org.junit.jupiter.api.Assertions;
21+
import org.junit.jupiter.api.Test;
22+
23+
public class ResultProxyClientTest {
24+
25+
@Test
26+
void instantiationTest() {
27+
Assertions.assertNotNull(ResultProxyClientBuilder.getInstance(Logger.Level.FULL, "localhost"));
28+
}
29+
30+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
rootProject.name = 'iexec-result-proxy'
2+
include 'iexec-result-proxy-library'

0 commit comments

Comments
 (0)