Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Java 17 #728

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.

## [[NEXT]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/vNEXT) 2025

### Quality

- Configuration server is now optional by default. (#728)

### Dependency Upgrades

- Upgrade to `eclipse-temurin:17.0.13_11-jre-focal`. (#728)
- Upgrade to Spring Boot 3.0.13. (#728)
- Upgrade to Spring Cloud 2022.0.5. (#728)
- Upgrade to Mongock 5.4.0. (#728)
- Upgrade to `org.springdoc:springdoc-openapi-starter-webmvc-ui` 2.6.0. (#728)

## [[8.6.0]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.6.0) 2024-12-23

### New Features
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM eclipse-temurin:11.0.24_8-jre-focal
FROM eclipse-temurin:17.0.13_11-jre-focal

ARG jar

RUN test -n "$jar"

RUN apt-get update \
RUN test -n "$jar" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't want to follow this suggestion here, at least today.
There can be good reasons to keep several RUN statements in the Dockerfile.
I propose to keep this for a later time and to revert the change to stay consistent across all projects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 5946dcd

&& apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*

Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id 'java'
id 'io.freefair.lombok' version '8.10.2'
id 'org.springframework.boot' version '2.7.18'
id 'org.springframework.boot' version '3.0.13'
id 'io.spring.dependency-management' version '1.1.6'
id 'jacoco'
id 'org.sonarqube' version '5.1.0.4882'
id 'maven-publish'
}

ext {
springCloudVersion = '2021.0.8'
springCloudVersion = '2022.0.5'
jjwtVersion = '0.11.5'
mongockVersion = '4.2.7.BETA'
mongockVersion = '5.4.0'
testContainersVersion = '1.20.4'
}

Expand Down Expand Up @@ -40,8 +40,8 @@ allprojects {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

Expand Down Expand Up @@ -75,7 +75,7 @@ dependencies {
implementation "org.springframework.retry:spring-retry"

// Spring Doc
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

// apache commons.lang3
implementation 'org.apache.commons:commons-lang3'
Expand All @@ -95,8 +95,8 @@ dependencies {
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'

// mongock
implementation "com.github.cloudyrock.mongock:mongock-spring-v5:${mongockVersion}"
implementation "com.github.cloudyrock.mongock:mongodb-springdata-v2-driver:${mongockVersion}"
implementation "io.mongock:mongock-springboot-v3:${mongockVersion}"
implementation "io.mongock:mongodb-springdata-v4-driver:${mongockVersion}"

// vavr
implementation 'io.vavr:vavr:0.10.4'
Expand All @@ -118,11 +118,11 @@ testing {
test {
useJUnitJupiter()
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-test'

// awaitility
implementation 'org.awaitility:awaitility'

implementation 'org.springframework.boot:spring-boot-starter-test'

// mongo
implementation "org.testcontainers:junit-jupiter:$testContainersVersion"
implementation "org.testcontainers:mongodb:$testContainersVersion"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version=8.6.0
iexecCommonsPocoVersion=4.2.0
iexecCommonVersion=8.6.0
iexecCommonsPocoVersion=4.2.0-NEXT-SNAPSHOT
iexecCommonVersion=8.6.0-NEXT-SNAPSHOT
iexecBlockchainAdapterVersion=8.6.0
iexecResultVersion=8.6.0
iexecSmsVersion=8.7.0
Expand Down
13 changes: 9 additions & 4 deletions iexec-core-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ plugins {
id 'maven-publish'
}

ext {
springBootVersion = '3.0.13'
}

dependencies {
implementation platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")

implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
// TODO remove this later when migration has been done
implementation project(':iexec-task-api')
}

java {
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
Expand All @@ -24,8 +30,7 @@ testing {
test {
useJUnitJupiter()
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.8.2'
implementation 'org.assertj:assertj-core:3.22.0'
implementation 'org.assertj:assertj-core'
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions iexec-task-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ plugins {
id 'maven-publish'
}

ext {
springBootVersion = '3.0.13'
}

dependencies {
implementation platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")

implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
}

java {
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
Expand All @@ -21,9 +27,6 @@ testing {
suites {
test {
useJUnitJupiter()
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
}
}
}
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/com/iexec/core/Application.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,12 +16,15 @@

package com.iexec.core;

import io.changock.runner.spring.v5.config.EnableChangock;
import io.mongock.driver.mongodb.springdata.v4.SpringDataMongoV4Driver;
import io.mongock.runner.springboot.EnableMongock;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.core.MongoTemplate;

@EnableChangock
@EnableMongock
@SpringBootApplication
@ConfigurationPropertiesScan
public class Application {
Expand All @@ -30,4 +33,9 @@ public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

@Bean
public SpringDataMongoV4Driver mongockDriver(MongoTemplate mongoTemplate) {
return SpringDataMongoV4Driver.withDefaultLock(mongoTemplate);
}

}
4 changes: 2 additions & 2 deletions src/main/java/com/iexec/core/chain/IexecHubService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@
import com.iexec.commons.poco.contract.generated.IexecHubContract;
import com.iexec.commons.poco.utils.BytesUtils;
import io.reactivex.Flowable;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.web3j.abi.EventEncoder;
Expand All @@ -29,7 +30,6 @@
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.TransactionReceipt;

import javax.annotation.PreDestroy;
import java.math.BigInteger;
import java.time.Instant;
import java.util.Date;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/iexec/core/chain/WalletConfiguration.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 IEXEC BLOCKCHAIN TECH
* Copyright 2024-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,9 @@
import com.iexec.commons.poco.chain.SignerService;
import lombok.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.context.annotation.Bean;

@Value
@ConstructorBinding
@ConfigurationProperties(prefix = "wallet")
public class WalletConfiguration {
String encryptedFilePath;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2021-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,13 +23,11 @@
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.context.annotation.Bean;

import java.time.Duration;

@Data
@ConstructorBinding
@ConfigurationProperties(prefix = "blockchain-adapter")
public class BlockchainAdapterClientConfig {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 IEXEC BLOCKCHAIN TECH
* Copyright 2024-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,11 +22,9 @@
import feign.Logger;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.context.annotation.Bean;

@Data
@ConstructorBinding
@ConfigurationProperties(prefix = "config-server")
public class ConfigServerClientConfig {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 IEXEC BLOCKCHAIN TECH
* Copyright 2021-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,25 +16,25 @@

package com.iexec.core.configuration;

import com.github.cloudyrock.mongock.driver.mongodb.springdata.v2.decorator.impl.MongockTemplate;
import com.mongodb.client.MongoCollection;
import io.changock.migration.api.annotations.ChangeLog;
import io.changock.migration.api.annotations.ChangeSet;
import io.mongock.api.annotations.ChangeUnit;
import io.mongock.api.annotations.Execution;
import io.mongock.api.annotations.RollbackExecution;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.math.BigInteger;

@Slf4j
@ChangeLog(order = "001")
@ChangeUnit(order = "001", id = "moveFromReplayField", author = "iexec")
public class ConfigurationRepositoryMigration {

public static final String CURRENT_AUTHOR = "iexec";
public static final String CONFIGURATION_COLLECTION_NAME = "configuration";
public static final String LEGACY_FROM_REPLAY_FIELD_NAME = "fromReplay";

@ChangeSet(order = "001", id = "moveFromReplayField", author = CURRENT_AUTHOR)
public boolean moveFromReplayField(MongockTemplate mongockTemplate, ReplayConfigurationRepository replayConfigurationRepository) {
@Execution
public boolean moveFromReplayField(MongoTemplate mongockTemplate, ReplayConfigurationRepository replayConfigurationRepository) {
if (replayConfigurationRepository.count() > 0) {
log.info("Migration of fromReplay field is useless (already up-to-date)");
return false;
Expand Down Expand Up @@ -64,4 +64,9 @@ public boolean moveFromReplayField(MongockTemplate mongockTemplate, ReplayConfig
return true;
}

@RollbackExecution
public void rollback(ReplayConfigurationRepository replayConfigurationRepository) {
replayConfigurationRepository.deleteAll();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2022-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,12 +19,11 @@
import com.iexec.commons.poco.chain.SignerService;
import com.iexec.core.chain.ChainConfig;
import com.iexec.core.config.PublicConfiguration;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.web3j.crypto.Hash;

import javax.annotation.PostConstruct;

/**
* This simple service will generate a random session id when the scheduler is started, it will be send to workers when
* they ping the scheduler. If they see that the session id has changed, it means that the scheduler has restarted.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,10 +23,8 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

@Value
@ConstructorBinding
@ConfigurationProperties(prefix = "result-repository")
@Slf4j
public class ResultRepositoryConfiguration {
Expand Down
Loading