Skip to content

Commit

Permalink
Merge pull request #71 from iExecBlockchainComputing/release/8.2.0
Browse files Browse the repository at this point in the history
Release/8.2.0
  • Loading branch information
jbern0rd authored Sep 28, 2023
2 parents e33b6bf + bc1aa69 commit c68128e
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 53 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

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

## [[8.2.0]](https://github.com/iExecBlockchainComputing/tee-worker-pre-compute/releases/tag/v8.2.0) 2023-09-28

### Quality
- Remove `nexus.intra.iex.ec` repository. (#62)
- Parameterize build of TEE applications while PR is not started. This allows faster builds. (#63 #64)
- Update `sconify.sh` script and rename `buildTeeImage` task to `buildSconeImage`. (#65)
- Upgrade to Gradle 8.2.1 with up-to-date plugins. (#67)
- Rename base package to `com.iexec.worker.compute.pre`. (#69)
- Rename worker REST api package to `com.iexec.worker.api`. (#69)
### Dependency Upgrades
- Upgrade to `jenkins-library` 2.7.3. (#63 #68)
- Upgrade to `eclipse-temurin` 11.0.20. (#66)
- Upgrade to `iexec-commons-poco` 3.1.0. (#70)
- Upgrade to `iexec-common` 8.3.0. (#70)

## [[8.1.3]](https://github.com/iExecBlockchainComputing/tee-worker-pre-compute/releases/tag/v8.1.3) 2023-06-23

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11.0.16-jre-slim
FROM eclipse-temurin:11.0.20_8-jre-focal

ARG jar

Expand Down
23 changes: 19 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
@Library('global-jenkins-library@2.5.0') _
@Library('global-jenkins-library@2.7.3') _

String repositoryName = 'tee-worker-pre-compute'

buildInfo = getBuildInfo()

// add parameters for non-PR builds when branch is not develop or production branch
boolean addParameters = !buildInfo.isPullRequestBuild && !buildInfo.isDevelopBranch && !buildInfo.isProductionBranch

// Override properties defined in getBuildInfo and add parameters
if (addParameters) {
properties([
buildDiscarder(logRotator(numToKeepStr: '10')),
parameters([booleanParam(description: 'Build TEE images', name: 'BUILD_TEE')])
])
}

buildJavaProject(
buildInfo: buildInfo,
integrationTestsEnvVars: [],
shouldPublishJars: false,
shouldPublishDockerImages: true,
dockerfileDir: '.',
buildContext: '.',
dockerImageRepositoryName: repositoryName,
preProductionVisibility: 'docker.io',
productionVisibility: 'docker.io')
dockerImageRepositoryName: repositoryName)

// BUILD_TEE parameter only exists if addParameters is true
// If BUILD_TEE is false, TEE builds won't be executed and we return here
if (addParameters && !params.BUILD_TEE) {
return
}

sconeBuildUnlocked(
nativeImage: "docker-regis.iex.ec/$repositoryName:$buildInfo.imageTag",
Expand Down
28 changes: 9 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'io.freefair.lombok' version '6.6.1'
id 'io.freefair.lombok' version '8.2.2'
id 'jacoco'
id 'org.sonarqube' version '3.3'
id 'org.sonarqube' version '4.2.1.3168'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

ext {
Expand Down Expand Up @@ -44,9 +44,6 @@ repositories {
password nexusPassword
}
}
maven {
url "https://nexus.intra.iex.ec/repository/maven-public/"
}
maven {
url "https://jitpack.io"
}
Expand All @@ -62,6 +59,7 @@ dependencies {

// test
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation 'org.assertj:assertj-core:3.18.1'
testImplementation "uk.org.webcompere:system-stubs-core:$systemStubsVersion" // activates env var setting
testImplementation "uk.org.webcompere:system-stubs-jupiter:$systemStubsVersion" // activates env var setting
Expand Down Expand Up @@ -92,9 +90,6 @@ tasks.withType(Test).configureEach {
useJUnitPlatform()
}

jacoco {
toolVersion = "0.8.7"
}
// sonarqube code coverage requires jacoco XML report
jacocoTestReport {
reports {
Expand All @@ -103,47 +98,42 @@ jacocoTestReport {
}
tasks.sonarqube.dependsOn tasks.jacocoTestReport

def mainClass = 'com.iexec.worker.tee.pre.Main'

//gradle run
application {
// Define the main class for the application.
mainClass = mainClass
mainClass.set('com.iexec.worker.compute.pre.Main')
}

// Jar with missing dependencies (app.jar)
jar {
manifest {
attributes(
'Main-Class': mainClass
)
attributes 'Main-Class': 'com.iexec.worker.compute.pre.Main'
}
}

// Jar with all dependencies (app-all.jar)
shadowJar {
mainClassName = mainClass
archiveBaseName.set('app')
archiveVersion.set('') // remove version from name
}

ext.jarPathForOCI = relativePath(tasks.shadowJar.outputs.files.singleFile)

task buildImage(type: Exec) {
tasks.register('buildImage', Exec) {
group 'Build'
description 'Builds an OCI image from a Dockerfile.'
dependsOn shadowJar
commandLine 'docker', 'build', '--build-arg', 'jar=' + jarPathForOCI, '-t', ociImageName, '.'
}

task buildTeeImage(type: Exec) {
tasks.register('buildSconeImage', Exec) {
dependsOn buildImage
environment 'IMG_FROM', ociImageName
environment 'IMG_TO', ociTeeImageName
commandLine 'docker/sconify.sh'
}

task itest(type: Test) {
tasks.register('itest', Test) {
group 'Verification'
description 'Runs the integration tests.'
dependsOn buildImage
Expand Down
4 changes: 2 additions & 2 deletions docker/sconify.args
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--name=tee-pre-compute \
--from=${IMG_FROM} \
--base=openjdk:11.0.16-jre-slim \
--base=eclipse-temurin:11.0.20_8-jre-focal \
--to=${IMG_TO} \
--binary-fs \
--fs-dir=/app \
--host-path=/etc/hosts \
--host-path=/etc/resolv.conf \
--binary=/usr/local/openjdk-11/bin/java \
--binary=/opt/java/openjdk/bin/java \
--heap="3G" \
--dlopen="1" \
--verbose \
Expand Down
6 changes: 3 additions & 3 deletions docker/sconify.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash
# IMG_FROM=docker.io/iexechub/tee-worker-pre-compute:dev IMG_TO=docker.io/iexechub/tee-worker-pre-compute:dev-debug ./sconify.sh

cd $(dirname $0)

SCONE_IMG_NAME=scone-debug/iexec-sconify-image-unlocked
SCONE_IMG_VERSION=5.7.1

IMG_TO=${IMG_TO}-sconify-${SCONE_IMG_VERSION}-debug
IMG_TO=${IMG_FROM}-sconify-${SCONE_IMG_VERSION}-debug

ARGS=$(sed -e "s'\${IMG_FROM}'${IMG_FROM}'" -e "s'\${IMG_TO}'${IMG_TO}'" sconify.args)
echo $ARGS

SCONE_IMAGE="registry.scontain.com:5050/${SCONE_IMG_NAME}:${SCONE_IMG_VERSION}"
SCONE_IMAGE="registry.scontain.com/${SCONE_IMG_NAME}:${SCONE_IMG_VERSION}"

/bin/bash -c "docker run -t --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version=8.1.3
iexecCommonVersion=8.2.1
iexecCommonsPocoVersion=3.0.4
version=8.2.0
iexecCommonVersion=8.3.0
iexecCommonsPocoVersion=3.1.0

nexusUser
nexusPassword
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
16 changes: 10 additions & 6 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,26 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre.worker;
package com.iexec.worker.api;

import com.iexec.common.worker.api.ExitMessage;
import feign.Param;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre.worker;
package com.iexec.worker.api;

import com.iexec.common.utils.FeignBuilder;
import feign.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

public class Main {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import com.iexec.common.security.CipherUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import com.iexec.common.worker.api.ExitMessage;
import feign.FeignException;
import lombok.extern.slf4j.Slf4j;

import static com.iexec.common.utils.IexecEnvUtils.IEXEC_TASK_ID;
import static com.iexec.worker.tee.pre.worker.WorkerApiManager.getWorkerApiClient;
import static com.iexec.worker.api.WorkerApiManager.getWorkerApiClient;

@Slf4j
public class PreComputeAppRunner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.iexec.worker.tee.pre.worker;
package com.iexec.worker.api;

import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import com.iexec.worker.tee.pre.worker.WorkerApiClient;
import com.iexec.worker.tee.pre.worker.WorkerApiManager;
import com.iexec.worker.api.WorkerApiClient;
import com.iexec.worker.api.WorkerApiManager;
import feign.FeignException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import com.iexec.common.utils.FileHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.iexec.worker.tee.pre;
package com.iexec.worker.compute.pre;

import com.iexec.common.replicate.ReplicateStatusCause;
import org.apache.commons.lang3.RandomStringUtils;
Expand Down

0 comments on commit c68128e

Please sign in to comment.