Skip to content

Commit

Permalink
Merge pull request #656 from iExecBlockchainComputing/release/8.3.0
Browse files Browse the repository at this point in the history
Release/8.3.0
  • Loading branch information
jbern0rd authored Jan 11, 2024
2 parents 1093c4a + a42cf70 commit 6400aa8
Show file tree
Hide file tree
Showing 75 changed files with 2,486 additions and 1,560 deletions.
135 changes: 117 additions & 18 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
FROM eclipse-temurin:11.0.20_8-jre-focal
FROM eclipse-temurin:11.0.21_9-jre-focal

ARG jar

RUN test -n "$jar"

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

RUN groupadd --system appuser \
&& useradd -g appuser -s /sbin/nologin -c "Docker image user" appuser

WORKDIR /app
COPY $jar iexec-core.jar
RUN chown -R appuser:appuser /app

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/iexec-core.jar"]
USER appuser
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "iexec-core.jar"]
8 changes: 2 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@Library('[email protected].3') _
@Library('[email protected].4') _
buildJavaProject(
buildInfo: getBuildInfo(),
integrationTestsEnvVars: [],
shouldPublishJars: true,
shouldPublishDockerImages: true,
dockerfileDir: '.',
buildContext: '.')
shouldPublishDockerImages: true)
61 changes: 31 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
plugins {
id 'java'
id 'io.freefair.lombok' version '8.2.2'
id 'org.springframework.boot' version '2.7.14'
id 'io.spring.dependency-management' version '1.1.3'
id 'org.springframework.boot' version '2.7.17'
id 'io.spring.dependency-management' version '1.1.4'
id 'jacoco'
id 'org.sonarqube' version '4.2.1.3168'
id 'maven-publish'
}

group = 'com.iexec.core'

ext {
springCloudVersion = '2021.0.8'
jjwtVersion = '0.11.5'
Expand All @@ -21,21 +19,30 @@ if (!project.hasProperty('gitBranch')) {
ext.gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
}

if (gitBranch != 'main' && gitBranch != 'master' && ! (gitBranch ==~ '(release|hotfix|support)/.*')) {
version += '-NEXT-SNAPSHOT'
}

repositories {
mavenLocal()
mavenCentral()
maven {
url "https://docker-regis-adm.iex.ec/repository/maven-public/"
credentials {
username nexusUser
password nexusPassword
allprojects {
group = 'com.iexec.core'
if (gitBranch != 'main' && gitBranch != 'master' && !(gitBranch ==~ '(release|hotfix|support)/.*')) {
version += '-NEXT-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://docker-regis-adm.iex.ec/repository/maven-public/"
credentials {
username nexusUser
password nexusPassword
}
}
maven { url "https://jitpack.io" }
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
sourceCompatibility = "11"
targetCompatibility = "11"
}
maven { url "https://jitpack.io" }
}

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

// spring
implementation "org.springframework.boot:spring-boot-starter"
Expand All @@ -66,7 +74,7 @@ dependencies {
implementation "org.springframework.retry:spring-retry"

// Spring Doc
implementation 'org.springdoc:springdoc-openapi-ui:1.6.3'
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'

// apache commons.lang3
implementation 'org.apache.commons:commons-lang3'
Expand Down Expand Up @@ -104,12 +112,6 @@ dependencies {
testImplementation "org.testcontainers:mongodb:$testContainersVersion"
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

jar {
enabled = true
archiveClassifier.set('library')
Expand All @@ -122,7 +124,7 @@ springBoot {
tasks.named("bootJar") {
manifest {
attributes("Implementation-Title": "iExec Core Scheduler",
"Implementation-Version": project.version)
"Implementation-Version": project.version)
}
}

Expand All @@ -141,7 +143,7 @@ jacocoTestReport {
xml.required = true
}
}
tasks.test.finalizedBy tasks.jacocoTestReport
tasks.test.finalizedBy tasks.jacocoTestReport
tasks.sonarqube.dependsOn tasks.jacocoTestReport

publishing {
Expand All @@ -162,14 +164,13 @@ publishing {
}
}

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

tasks.register('buildImage', Exec) {
group 'Build'
description 'Builds an OCI image from a Dockerfile.'
dependsOn bootJar
commandLine("sh", "-c", "docker build --build-arg jar=$jarPathForOCI -t $ociImageName:$gitShortCommit . &&" +
"docker tag $ociImageName:$gitShortCommit $ociImageName:dev")
commandLine 'docker', 'build', '--build-arg', 'jar=' + jarPathForOCI, '-t', ociImageName + ':dev', '.'
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version=8.2.3
iexecCommonVersion=8.3.0
iexecCommonsPocoVersion=3.1.0
iexecBlockchainAdapterVersion=8.2.0
iexecResultVersion=8.2.0
iexecSmsVersion=8.3.0
version=8.3.0
iexecCommonVersion=8.3.1
iexecCommonsPocoVersion=3.2.0
iexecBlockchainAdapterVersion=8.3.0
iexecResultVersion=8.3.0
iexecSmsVersion=8.4.0

nexusUser
nexusPassword
50 changes: 50 additions & 0 deletions iexec-core-library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
plugins {
id 'java-library'
id 'io.freefair.lombok'
id 'jacoco'
id 'maven-publish'
}

dependencies {
implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

java {
sourceCompatibility = "11"
targetCompatibility = "11"
withJavadocJar()
withSourcesJar()
}


tasks.withType(Test).configureEach {
finalizedBy tasks.jacocoTestReport
useJUnitPlatform()
}

// sonarqube code coverage requires jacoco XML report
jacocoTestReport {
reports {
xml.required = true
}
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
credentials {
username nexusUser
password nexusPassword
}
url = project.hasProperty("nexusUrl")? project.nexusUrl: ''
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright 2023-2023 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.iexec.core.api;

import com.iexec.common.config.PublicConfiguration;
import com.iexec.common.config.WorkerModel;
import com.iexec.common.replicate.ComputeLogs;
import com.iexec.common.replicate.ReplicateStatusUpdate;
import com.iexec.common.replicate.ReplicateTaskSummary;
import com.iexec.commons.poco.eip712.entity.EIP712Challenge;
import com.iexec.commons.poco.notification.TaskNotification;
import com.iexec.commons.poco.notification.TaskNotificationType;
import com.iexec.core.logs.TaskLogsModel;
import com.iexec.core.metric.PlatformMetric;
import com.iexec.core.task.TaskModel;
import feign.Headers;
import feign.Param;
import feign.RequestLine;

import java.security.Signature;
import java.util.List;

public interface SchedulerClient {
@RequestLine("GET /metrics")
PlatformMetric getMetrics();

@RequestLine("GET /version")
String getCoreVersion();

// region /workers
@RequestLine("GET /workers/challenge?walletAddress={walletAddress}")
String getChallenge(@Param("walletAddress") String walletAddress);

@RequestLine("POST /workers/login?walletAddress={walletAddress}")
String login(@Param("walletAddress") String walletAddress, Signature signature);

@RequestLine("POST /workers/ping")
@Headers("Authorization: {authorization}")
String ping(@Param("authorization") String authorization);

@RequestLine("POST /workers/register")
@Headers("Authorization: {authorization}")
void registerWorker(@Param("authorization") String authorization, WorkerModel model);

@RequestLine("GET /workers/config")
PublicConfiguration getPublicConfiguration();

@RequestLine("GET /workers/computing")
@Headers("Authorization: {authorization}")
List<String> getComputingTasks(@Param("authorization") String authorization);
// endregion

// region /replicates
@RequestLine("GET /replicates/available?blockNumber={blockNumber}")
@Headers("Authorization: {authorization}")
ReplicateTaskSummary getAvailableReplicateTaskSummary(
@Param("authorization") String authorization, @Param("blockNumber") long blockNumber);

@RequestLine("GET /replicates/interrupted?blockNumber={blockNumber}")
@Headers("Authorization: {authorization}")
List<TaskNotification> getMissedTaskNotifications(
@Param("authorization") String authorization, @Param("blockNumber") long blockNumber);

@RequestLine("POST /replicates/{chainTaskId}/updateStatus")
@Headers("Authorization: {authorization}")
TaskNotificationType updateReplicateStatus(
@Param("authorization") String authorization,
@Param("chainTaskId") String chainTaskId,
ReplicateStatusUpdate replicateStatusUpdate
);
// endregion

// region /tasks
@RequestLine("GET /tasks/{chainTaskId}")
TaskModel getTask(@Param("chainTaskId") String chainTaskId);

@RequestLine("GET /tasks/logs/challenge?address={address}")
EIP712Challenge getTaskLogsChallenge(@Param("address") String address);

@Headers("Authorization: {authorization}")
@RequestLine("GET /tasks/{chainTaskId}/logs")
TaskLogsModel getTaskLogs(
@Param("chainTaskId") String chainTaskId,
@Param("authorization") String authorization);

@Headers("Authorization: {authorization}")
@RequestLine("GET /tasks/{chainTaskId}/replicates/{walletAddress}/logs")
ComputeLogs getComputeLogs(
@Param("chainTaskId") String chainTaskId,
@Param("walletAddress") String walletAddress,
@Param("authorization") String authorization);
// endregion
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
* Copyright 2023-2023 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 @@ -14,22 +14,17 @@
* limitations under the License.
*/

package com.iexec.core.version;
package com.iexec.core.api;

import org.springframework.boot.info.BuildProperties;
import org.springframework.stereotype.Service;
import com.iexec.common.utils.FeignBuilder;
import feign.Logger;

@Service
public class VersionService {
public class SchedulerClientBuilder {

private final BuildProperties buildProperties;
private SchedulerClientBuilder() {}

VersionService (BuildProperties buildProperties) {
this.buildProperties = buildProperties;
public static SchedulerClient getInstance(Logger.Level logLevel, String url) {
return FeignBuilder.createBuilder(logLevel)
.target(SchedulerClient.class, url);
}

public String getVersion() {
return buildProperties.getVersion();
}

}
Loading

0 comments on commit 6400aa8

Please sign in to comment.