Skip to content

Commit 6400aa8

Browse files
authored
Merge pull request #656 from iExecBlockchainComputing/release/8.3.0
Release/8.3.0
2 parents 1093c4a + a42cf70 commit 6400aa8

File tree

75 files changed

+2486
-1560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2486
-1560
lines changed

CHANGELOG.md

Lines changed: 117 additions & 18 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
FROM eclipse-temurin:11.0.20_8-jre-focal
1+
FROM eclipse-temurin:11.0.21_9-jre-focal
22

33
ARG jar
44

55
RUN test -n "$jar"
66

77
RUN apt-get update \
8-
&& apt-get install -y curl \
8+
&& apt-get install -y --no-install-recommends curl \
99
&& rm -rf /var/lib/apt/lists/*
1010

11+
RUN groupadd --system appuser \
12+
&& useradd -g appuser -s /sbin/nologin -c "Docker image user" appuser
13+
14+
WORKDIR /app
1115
COPY $jar iexec-core.jar
16+
RUN chown -R appuser:appuser /app
1217

13-
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/iexec-core.jar"]
18+
USER appuser
19+
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "iexec-core.jar"]

Jenkinsfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
@Library('[email protected].3') _
1+
@Library('[email protected].4') _
22
buildJavaProject(
3-
buildInfo: getBuildInfo(),
4-
integrationTestsEnvVars: [],
53
shouldPublishJars: true,
6-
shouldPublishDockerImages: true,
7-
dockerfileDir: '.',
8-
buildContext: '.')
4+
shouldPublishDockerImages: true)

build.gradle

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
plugins {
22
id 'java'
33
id 'io.freefair.lombok' version '8.2.2'
4-
id 'org.springframework.boot' version '2.7.14'
5-
id 'io.spring.dependency-management' version '1.1.3'
4+
id 'org.springframework.boot' version '2.7.17'
5+
id 'io.spring.dependency-management' version '1.1.4'
66
id 'jacoco'
77
id 'org.sonarqube' version '4.2.1.3168'
88
id 'maven-publish'
99
}
1010

11-
group = 'com.iexec.core'
12-
1311
ext {
1412
springCloudVersion = '2021.0.8'
1513
jjwtVersion = '0.11.5'
@@ -21,21 +19,30 @@ if (!project.hasProperty('gitBranch')) {
2119
ext.gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
2220
}
2321

24-
if (gitBranch != 'main' && gitBranch != 'master' && ! (gitBranch ==~ '(release|hotfix|support)/.*')) {
25-
version += '-NEXT-SNAPSHOT'
26-
}
27-
28-
repositories {
29-
mavenLocal()
30-
mavenCentral()
31-
maven {
32-
url "https://docker-regis-adm.iex.ec/repository/maven-public/"
33-
credentials {
34-
username nexusUser
35-
password nexusPassword
22+
allprojects {
23+
group = 'com.iexec.core'
24+
if (gitBranch != 'main' && gitBranch != 'master' && !(gitBranch ==~ '(release|hotfix|support)/.*')) {
25+
version += '-NEXT-SNAPSHOT'
26+
}
27+
repositories {
28+
mavenLocal()
29+
mavenCentral()
30+
maven {
31+
url "https://docker-regis-adm.iex.ec/repository/maven-public/"
32+
credentials {
33+
username nexusUser
34+
password nexusPassword
35+
}
36+
}
37+
maven { url "https://jitpack.io" }
38+
}
39+
java {
40+
toolchain {
41+
languageVersion.set(JavaLanguageVersion.of(17))
3642
}
43+
sourceCompatibility = "11"
44+
targetCompatibility = "11"
3745
}
38-
maven { url "https://jitpack.io" }
3946
}
4047

4148
dependencyManagement {
@@ -51,6 +58,7 @@ dependencies {
5158
implementation "com.iexec.blockchain:iexec-blockchain-adapter-api-library:$iexecBlockchainAdapterVersion"
5259
implementation "com.iexec.result-proxy:iexec-result-proxy-library:$iexecResultVersion"
5360
implementation "com.iexec.sms:iexec-sms-library:$iexecSmsVersion"
61+
implementation project(':iexec-core-library')
5462

5563
// spring
5664
implementation "org.springframework.boot:spring-boot-starter"
@@ -66,7 +74,7 @@ dependencies {
6674
implementation "org.springframework.retry:spring-retry"
6775

6876
// Spring Doc
69-
implementation 'org.springdoc:springdoc-openapi-ui:1.6.3'
77+
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
7078

7179
// apache commons.lang3
7280
implementation 'org.apache.commons:commons-lang3'
@@ -104,12 +112,6 @@ dependencies {
104112
testImplementation "org.testcontainers:mongodb:$testContainersVersion"
105113
}
106114

107-
java {
108-
toolchain {
109-
languageVersion.set(JavaLanguageVersion.of(11))
110-
}
111-
}
112-
113115
jar {
114116
enabled = true
115117
archiveClassifier.set('library')
@@ -122,7 +124,7 @@ springBoot {
122124
tasks.named("bootJar") {
123125
manifest {
124126
attributes("Implementation-Title": "iExec Core Scheduler",
125-
"Implementation-Version": project.version)
127+
"Implementation-Version": project.version)
126128
}
127129
}
128130

@@ -141,7 +143,7 @@ jacocoTestReport {
141143
xml.required = true
142144
}
143145
}
144-
tasks.test.finalizedBy tasks.jacocoTestReport
146+
tasks.test.finalizedBy tasks.jacocoTestReport
145147
tasks.sonarqube.dependsOn tasks.jacocoTestReport
146148

147149
publishing {
@@ -162,14 +164,13 @@ publishing {
162164
}
163165
}
164166

165-
ext.jarPathForOCI = relativePath(tasks.bootJar.outputs.files.singleFile)
167+
ext.jarPathForOCI = relativePath(tasks.bootJar.outputs.files.singleFile)
166168
ext.gitShortCommit = 'git rev-parse --short=8 HEAD'.execute().text.trim()
167-
ext.ociImageName = 'local/' + ['bash', '-c', 'basename $(git config --get remote.origin.url) .git'].execute().text.trim()
169+
ext.ociImageName = 'local/' + ['bash', '-c', 'basename $(git config --get remote.origin.url) .git'].execute().text.trim()
168170

169171
tasks.register('buildImage', Exec) {
170172
group 'Build'
171173
description 'Builds an OCI image from a Dockerfile.'
172174
dependsOn bootJar
173-
commandLine("sh", "-c", "docker build --build-arg jar=$jarPathForOCI -t $ociImageName:$gitShortCommit . &&" +
174-
"docker tag $ociImageName:$gitShortCommit $ociImageName:dev")
175+
commandLine 'docker', 'build', '--build-arg', 'jar=' + jarPathForOCI, '-t', ociImageName + ':dev', '.'
175176
}

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
version=8.2.3
2-
iexecCommonVersion=8.3.0
3-
iexecCommonsPocoVersion=3.1.0
4-
iexecBlockchainAdapterVersion=8.2.0
5-
iexecResultVersion=8.2.0
6-
iexecSmsVersion=8.3.0
1+
version=8.3.0
2+
iexecCommonVersion=8.3.1
3+
iexecCommonsPocoVersion=3.2.0
4+
iexecBlockchainAdapterVersion=8.3.0
5+
iexecResultVersion=8.3.0
6+
iexecSmsVersion=8.4.0
77

88
nexusUser
99
nexusPassword

iexec-core-library/build.gradle

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
plugins {
2+
id 'java-library'
3+
id 'io.freefair.lombok'
4+
id 'jacoco'
5+
id 'maven-publish'
6+
}
7+
8+
dependencies {
9+
implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
10+
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
11+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
12+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
13+
}
14+
15+
java {
16+
sourceCompatibility = "11"
17+
targetCompatibility = "11"
18+
withJavadocJar()
19+
withSourcesJar()
20+
}
21+
22+
23+
tasks.withType(Test).configureEach {
24+
finalizedBy tasks.jacocoTestReport
25+
useJUnitPlatform()
26+
}
27+
28+
// sonarqube code coverage requires jacoco XML report
29+
jacocoTestReport {
30+
reports {
31+
xml.required = true
32+
}
33+
}
34+
35+
publishing {
36+
publications {
37+
maven(MavenPublication) {
38+
from components.java
39+
}
40+
}
41+
repositories {
42+
maven {
43+
credentials {
44+
username nexusUser
45+
password nexusPassword
46+
}
47+
url = project.hasProperty("nexusUrl")? project.nexusUrl: ''
48+
}
49+
}
50+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Copyright 2023-2023 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.core.api;
18+
19+
import com.iexec.common.config.PublicConfiguration;
20+
import com.iexec.common.config.WorkerModel;
21+
import com.iexec.common.replicate.ComputeLogs;
22+
import com.iexec.common.replicate.ReplicateStatusUpdate;
23+
import com.iexec.common.replicate.ReplicateTaskSummary;
24+
import com.iexec.commons.poco.eip712.entity.EIP712Challenge;
25+
import com.iexec.commons.poco.notification.TaskNotification;
26+
import com.iexec.commons.poco.notification.TaskNotificationType;
27+
import com.iexec.core.logs.TaskLogsModel;
28+
import com.iexec.core.metric.PlatformMetric;
29+
import com.iexec.core.task.TaskModel;
30+
import feign.Headers;
31+
import feign.Param;
32+
import feign.RequestLine;
33+
34+
import java.security.Signature;
35+
import java.util.List;
36+
37+
public interface SchedulerClient {
38+
@RequestLine("GET /metrics")
39+
PlatformMetric getMetrics();
40+
41+
@RequestLine("GET /version")
42+
String getCoreVersion();
43+
44+
// region /workers
45+
@RequestLine("GET /workers/challenge?walletAddress={walletAddress}")
46+
String getChallenge(@Param("walletAddress") String walletAddress);
47+
48+
@RequestLine("POST /workers/login?walletAddress={walletAddress}")
49+
String login(@Param("walletAddress") String walletAddress, Signature signature);
50+
51+
@RequestLine("POST /workers/ping")
52+
@Headers("Authorization: {authorization}")
53+
String ping(@Param("authorization") String authorization);
54+
55+
@RequestLine("POST /workers/register")
56+
@Headers("Authorization: {authorization}")
57+
void registerWorker(@Param("authorization") String authorization, WorkerModel model);
58+
59+
@RequestLine("GET /workers/config")
60+
PublicConfiguration getPublicConfiguration();
61+
62+
@RequestLine("GET /workers/computing")
63+
@Headers("Authorization: {authorization}")
64+
List<String> getComputingTasks(@Param("authorization") String authorization);
65+
// endregion
66+
67+
// region /replicates
68+
@RequestLine("GET /replicates/available?blockNumber={blockNumber}")
69+
@Headers("Authorization: {authorization}")
70+
ReplicateTaskSummary getAvailableReplicateTaskSummary(
71+
@Param("authorization") String authorization, @Param("blockNumber") long blockNumber);
72+
73+
@RequestLine("GET /replicates/interrupted?blockNumber={blockNumber}")
74+
@Headers("Authorization: {authorization}")
75+
List<TaskNotification> getMissedTaskNotifications(
76+
@Param("authorization") String authorization, @Param("blockNumber") long blockNumber);
77+
78+
@RequestLine("POST /replicates/{chainTaskId}/updateStatus")
79+
@Headers("Authorization: {authorization}")
80+
TaskNotificationType updateReplicateStatus(
81+
@Param("authorization") String authorization,
82+
@Param("chainTaskId") String chainTaskId,
83+
ReplicateStatusUpdate replicateStatusUpdate
84+
);
85+
// endregion
86+
87+
// region /tasks
88+
@RequestLine("GET /tasks/{chainTaskId}")
89+
TaskModel getTask(@Param("chainTaskId") String chainTaskId);
90+
91+
@RequestLine("GET /tasks/logs/challenge?address={address}")
92+
EIP712Challenge getTaskLogsChallenge(@Param("address") String address);
93+
94+
@Headers("Authorization: {authorization}")
95+
@RequestLine("GET /tasks/{chainTaskId}/logs")
96+
TaskLogsModel getTaskLogs(
97+
@Param("chainTaskId") String chainTaskId,
98+
@Param("authorization") String authorization);
99+
100+
@Headers("Authorization: {authorization}")
101+
@RequestLine("GET /tasks/{chainTaskId}/replicates/{walletAddress}/logs")
102+
ComputeLogs getComputeLogs(
103+
@Param("chainTaskId") String chainTaskId,
104+
@Param("walletAddress") String walletAddress,
105+
@Param("authorization") String authorization);
106+
// endregion
107+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,22 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.iexec.core.version;
17+
package com.iexec.core.api;
1818

19-
import org.springframework.boot.info.BuildProperties;
20-
import org.springframework.stereotype.Service;
19+
import com.iexec.common.utils.FeignBuilder;
20+
import feign.Logger;
2121

22-
@Service
23-
public class VersionService {
22+
public class SchedulerClientBuilder {
2423

25-
private final BuildProperties buildProperties;
24+
private SchedulerClientBuilder() {}
2625

27-
VersionService (BuildProperties buildProperties) {
28-
this.buildProperties = buildProperties;
26+
public static SchedulerClient getInstance(Logger.Level logLevel, String url) {
27+
return FeignBuilder.createBuilder(logLevel)
28+
.target(SchedulerClient.class, url);
2929
}
30-
31-
public String getVersion() {
32-
return buildProperties.getVersion();
33-
}
34-
3530
}

0 commit comments

Comments
 (0)