Skip to content

Commit feef788

Browse files
authored
Merge pull request #604 from iExecBlockchainComputing/release/8.5.0
Release/8.5.0
2 parents ae90fc7 + 94dfe00 commit feef788

File tree

55 files changed

+1246
-1076
lines changed

Some content is hidden

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

55 files changed

+1246
-1076
lines changed

CHANGELOG.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [[8.5.0]](https://github.com/iExecBlockchainComputing/iexec-worker/releases/tag/v8.5.0) 2024-06-19
6+
7+
### New Features
8+
9+
- Add `iexec-core-library` dependency and use it. (#595)
10+
- Create `ConfigServerClient` instance and use it instead of `BlockchainAdapterApiClient`. (#596)
11+
- Replace `CredentialsService` with `SignerService`. (#602)
12+
13+
### Bug fixes
14+
15+
- Fix `LoginServiceTests#shouldLoginOnceOnSimultaneousCalls` test. (#587)
16+
- Always use `WorkerpoolAuhorization` to retrieve JWT on Result Proxy. (#588)
17+
- Improve checks when receiving a `computed.json` file from a REST call. (#598)
18+
- Avoid `NullPointerException` on empty enclave configuration during TEE pre-compute. (#601)
19+
20+
### Quality
21+
22+
- Configure Gradle JVM Test Suite Plugin. (#589)
23+
- Remove `ResponseEntity` wrapper in feign client. (#593)
24+
- Use constructor injection in `Application` class. (#594)
25+
- Transform `CoreConfigurationService` to immutable `SchedulerConfiguration` class. (#597)
26+
- Move `ReplicateActionResponse` from `iexec-common` to `iexec-worker`. (#599)
27+
- Use `ReplicateTaskSummary` from `iexce-core-library`. (#600)
28+
29+
### Dependency Upgrades
30+
31+
- Upgrade to Gradle 8.7. (#590)
32+
- Upgrade to `eclipse-temurin:11.0.22_7-jre-focal`. (#591)
33+
- Upgrade to Spring Boot 2.7.18. (#592)
34+
- Upgrade to `iexec-commons-poco` 4.1.0. (#603)
35+
- Upgrade to `iexec-common` 8.5.0. (#603)
36+
- Upgrade to `iexec-commons-containers` 1.2.2. (#603)
37+
- Upgrade to `iexec-result-proxy-library` 8.5.0. (#603)
38+
- Upgrade to `iexec-sms-library` 8.6.0. (#603)
39+
- Upgrade to `iexec-core-library` 8.5.0. (#603)
40+
541
## [[8.4.0]](https://github.com/iExecBlockchainComputing/iexec-worker/releases/tag/v8.4.0) 2024-02-29
642

743
### New Features
@@ -19,9 +55,9 @@ All notable changes to this project will be documented in this file.
1955
### Dependency Upgrades
2056

2157
- Upgrade to `iexec-common` 8.4.0. (#583)
22-
- Upgrade to `iexec-blockchain-adapter` 8.4.0. (#584)
23-
- Upgrade to `iexec-result-proxy` 8.4.0. (#584)
24-
- Upgrade to `iexec-sms` 8.5.0. (#584)
58+
- Upgrade to `iexec-blockchain-adapter-library` 8.4.0. (#584)
59+
- Upgrade to `iexec-result-proxy-library` 8.4.0. (#584)
60+
- Upgrade to `iexec-sms-library` 8.5.0. (#584)
2561

2662
## [[8.3.0]](https://github.com/iExecBlockchainComputing/iexec-worker/releases/tag/v8.3.0) 2024-01-11
2763

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM eclipse-temurin:11.0.21_9-jre-focal
1+
FROM eclipse-temurin:11.0.22_7-jre-focal
22

33
ARG jar
44

build.gradle

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
22
id 'java'
3-
id 'io.freefair.lombok' version '8.2.2'
4-
id 'org.springframework.boot' version '2.7.17'
3+
id 'io.freefair.lombok' version '8.6'
4+
id 'org.springframework.boot' version '2.7.18'
55
id 'io.spring.dependency-management' version '1.1.4'
66
id 'jacoco'
7-
id 'org.sonarqube' version '4.2.1.3168'
7+
id 'org.sonarqube' version '5.0.0.4638'
88
id 'maven-publish'
99
}
1010

@@ -13,6 +13,7 @@ group = 'com.iexec.worker'
1313
ext {
1414
springCloudVersion = '2021.0.8'
1515
commonsMathsVersion = '3.6.1'
16+
testContainersVersion = '1.19.3'
1617
}
1718

1819
if (!project.hasProperty('gitBranch')) {
@@ -49,9 +50,9 @@ dependencies {
4950
implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
5051
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
5152
implementation "com.iexec.commons:iexec-commons-containers:$iexecCommonsContainersVersion"
52-
implementation "com.iexec.blockchain:iexec-blockchain-adapter-api-library:$iexecBlockchainAdapterVersion"
5353
implementation "com.iexec.result-proxy:iexec-result-proxy-library:$iexecResultVersion"
5454
implementation "com.iexec.sms:iexec-sms-library:$iexecSmsVersion"
55+
implementation "com.iexec.core:iexec-core-library:$iexecCoreVersion"
5556

5657
// spring
5758
implementation "org.springframework.boot:spring-boot-starter"
@@ -84,14 +85,6 @@ dependencies {
8485

8586
// expiring map
8687
implementation 'net.jodah:expiringmap:0.5.10'
87-
88-
// tests
89-
testImplementation "org.springframework.boot:spring-boot-starter-test"
90-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
91-
testImplementation "org.mockito:mockito-inline" // activates mocking final classes/methods
92-
93-
// awaitility
94-
testImplementation "org.awaitility:awaitility"
9588
}
9689

9790
java {
@@ -113,8 +106,26 @@ tasks.named("bootJar") {
113106
}
114107
}
115108

116-
test {
117-
useJUnitPlatform()
109+
testing {
110+
suites {
111+
test {
112+
useJUnitJupiter()
113+
dependencies {
114+
implementation "org.springframework.boot:spring-boot-starter-test"
115+
implementation "org.mockito:mockito-inline" // activates mocking final classes/methods
116+
117+
// awaitility
118+
implementation "org.awaitility:awaitility"
119+
120+
// testcontainers
121+
implementation "org.testcontainers:junit-jupiter:$testContainersVersion"
122+
}
123+
}
124+
}
125+
}
126+
127+
tasks.withType(Test).configureEach {
128+
finalizedBy jacocoTestReport
118129
}
119130

120131
tasks.register('itest') {
@@ -128,7 +139,6 @@ jacocoTestReport {
128139
xml.required = true
129140
}
130141
}
131-
tasks.test.finalizedBy tasks.jacocoTestReport
132142
tasks.sonarqube.dependsOn tasks.jacocoTestReport
133143

134144
publishing {

gradle.properties

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
version=8.4.0
2-
iexecCommonVersion=8.4.0
3-
iexecCommonsContainersVersion=1.2.1
4-
iexecCommonsPocoVersion=3.2.0
5-
iexecBlockchainAdapterVersion=8.4.0
6-
iexecResultVersion=8.4.0
7-
iexecSmsVersion=8.5.0
8-
1+
version=8.5.0
2+
iexecCommonVersion=8.5.0
3+
iexecCommonsContainersVersion=1.2.2
4+
iexecCommonsPocoVersion=4.1.0
5+
iexecResultVersion=8.5.0
6+
iexecSmsVersion=8.6.0
7+
iexecCoreVersion=8.5.0
98
nexusUser
109
nexusPassword

gradle/wrapper/gradle-wrapper.jar

-19.5 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum
@@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -201,11 +202,11 @@ fi
201202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203204

204-
# Collect all arguments for the java command;
205-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
206-
# shell script including quotes and variable substitutions, so put them in
207-
# double quotes to make sure that they get re-expanded; and
208-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
209210

210211
set -- \
211212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

gradlew.bat

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
4343
%JAVA_EXE% -version >NUL 2>&1
4444
if %ERRORLEVEL% equ 0 goto execute
4545

46-
echo.
47-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48-
echo.
49-
echo Please set the JAVA_HOME variable in your environment to match the
50-
echo location of your Java installation.
46+
echo. 1>&2
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48+
echo. 1>&2
49+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50+
echo location of your Java installation. 1>&2
5151

5252
goto fail
5353

@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5757

5858
if exist "%JAVA_EXE%" goto execute
5959

60-
echo.
61-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62-
echo.
63-
echo Please set the JAVA_HOME variable in your environment to match the
64-
echo location of your Java installation.
60+
echo. 1>&2
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62+
echo. 1>&2
63+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64+
echo location of your Java installation. 1>&2
6565

6666
goto fail
6767

src/main/java/com/iexec/worker/Application.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.iexec.worker;
1818

19-
2019
import com.iexec.worker.chain.IexecHubService;
2120
import com.iexec.worker.feign.LoginService;
2221
import com.iexec.worker.replicate.ReplicateRecoveryService;
@@ -25,7 +24,6 @@
2524
import com.iexec.worker.worker.WorkerService;
2625
import lombok.extern.slf4j.Slf4j;
2726
import org.apache.commons.lang3.StringUtils;
28-
import org.springframework.beans.factory.annotation.Autowired;
2927
import org.springframework.boot.CommandLineRunner;
3028
import org.springframework.boot.SpringApplication;
3129
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -44,23 +42,26 @@
4442
@ConfigurationPropertiesScan
4543
public class Application implements CommandLineRunner {
4644

47-
@Autowired
48-
private String workerWalletAddress;
49-
50-
@Autowired
51-
private IexecHubService iexecHubService;
52-
53-
@Autowired
54-
private LoginService loginService;
55-
56-
@Autowired
57-
private WorkerService workerService;
58-
59-
@Autowired
60-
private ReplicateRecoveryService replicateRecoveryService;
61-
62-
@Autowired
63-
private ResultService resultService;
45+
private final String workerWalletAddress;
46+
private final IexecHubService iexecHubService;
47+
private final LoginService loginService;
48+
private final WorkerService workerService;
49+
private final ReplicateRecoveryService replicateRecoveryService;
50+
private final ResultService resultService;
51+
52+
public Application(String workerWalletAddress,
53+
IexecHubService iexecHubService,
54+
LoginService loginService,
55+
WorkerService workerService,
56+
ReplicateRecoveryService replicateRecoveryService,
57+
ResultService resultService) {
58+
this.workerWalletAddress = workerWalletAddress;
59+
this.iexecHubService = iexecHubService;
60+
this.loginService = loginService;
61+
this.workerService = workerService;
62+
this.replicateRecoveryService = replicateRecoveryService;
63+
this.resultService = resultService;
64+
}
6465

6566
public static void main(String[] args) {
6667
SpringApplication.run(Application.class, args);

src/main/java/com/iexec/worker/PingService.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2024 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.
@@ -16,9 +16,8 @@
1616

1717
package com.iexec.worker;
1818

19-
import com.iexec.worker.config.CoreConfigurationService;
19+
import com.iexec.core.api.SchedulerClient;
2020
import com.iexec.worker.feign.LoginService;
21-
import com.iexec.worker.feign.client.CoreClient;
2221
import com.iexec.worker.utils.AsyncUtils;
2322
import com.iexec.worker.utils.ExecutorUtils;
2423
import com.iexec.worker.worker.WorkerService;
@@ -38,19 +37,18 @@ public class PingService {
3837
private static final int PING_RATE_IN_SECONDS = 10;
3938

4039
private final Executor executor;
41-
private final CoreClient coreClient;
42-
private final CoreConfigurationService coreConfigurationService;
40+
private final SchedulerClient schedulerClient;
4341
private final LoginService loginService;
4442
private final WorkerService workerService;
4543

46-
public PingService(CoreClient coreClient,
47-
CoreConfigurationService coreConfigurationService,
44+
private String coreSessionId;
45+
46+
public PingService(SchedulerClient schedulerClient,
4847
LoginService loginService,
4948
WorkerService workerService) {
5049
executor = ExecutorUtils
5150
.newSingleThreadExecutorWithFixedSizeQueue(1, "ping-");
52-
this.coreClient = coreClient;
53-
this.coreConfigurationService = coreConfigurationService;
51+
this.schedulerClient = schedulerClient;
5452
this.loginService = loginService;
5553
this.workerService = workerService;
5654
}
@@ -78,7 +76,7 @@ void pingScheduler() {
7876
log.debug("Sending ping to scheduler");
7977
final String sessionId;
8078
try {
81-
sessionId = coreClient.ping(loginService.getToken());
79+
sessionId = schedulerClient.ping(loginService.getToken());
8280
} catch (FeignException e) {
8381
log.warn("The worker cannot ping the core [status:{}]", e.status());
8482
if (e instanceof FeignException.Unauthorized) {
@@ -97,16 +95,15 @@ void pingScheduler() {
9795
if (now.getMinute() == 0 && now.getSecond() <= PING_RATE_IN_SECONDS) {
9896
log.info("Sent ping to scheduler [sessionId:{}]", sessionId);
9997
}
100-
String currentSessionId = coreConfigurationService.getCoreSessionId();
101-
if (StringUtils.isEmpty(currentSessionId)) {
98+
if (StringUtils.isEmpty(coreSessionId)) {
10299
log.info("First ping from the worker, setting the sessionId [coreSessionId:{}]", sessionId);
103-
coreConfigurationService.setCoreSessionId(sessionId);
100+
coreSessionId = sessionId;
104101
return;
105102
}
106-
if (!sessionId.equalsIgnoreCase(currentSessionId)) {
103+
if (!sessionId.equalsIgnoreCase(coreSessionId)) {
107104
// need to reconnect to the core by restarting the worker
108-
log.warn("Scheduler seems to have restarted [currentSessionId:{}, " +
109-
"coreSessionId:{}]", currentSessionId, sessionId);
105+
log.warn("Scheduler seems to have restarted [currentSessionId:{}, coreSessionId:{}]",
106+
coreSessionId, sessionId);
110107
workerService.restartGracefully();
111108
}
112109
}

0 commit comments

Comments
 (0)