Skip to content

Commit

Permalink
Merge pull request #52 from iExecBlockchainComputing/release/8.0.0
Browse files Browse the repository at this point in the history
Release/8.0.0
  • Loading branch information
jeremyjams authored Mar 8, 2023
2 parents 20aa760 + 1a675a3 commit 644dda4
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 233 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

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

## [[8.0.0]](https://github.com/iExecBlockchainComputing/tee-worker-pre-compute/releases/tag/v8.0.0) 2023-03-08

### New Features
* #44 Set scone heap to 3G.
* #43 Upgrade to scone 5.7.
### Quality
* #48 Remove deprecated Palantir Docker Gradle plugin.
* #39 #37 Improve code coverage.
* #33 Improve Task Feedback support.
* #45 #35 Add sonar support.
* #34 Only build internal scone image in this pipeline.
### Dependency Upgrades
* #50 Upgrade to `iexec-common` 7.0.0.
* #51 #46 #42 #38 #36 Upgrade to `jenkins-library` 2.5.0.
* #49 Replace the deprecated `openjdk` Docker base image with `eclipse-temurin` and upgrade to Java 11.0.16 patch.
* #47 Upgrade to Gradle 7.6.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openjdk:11.0.16-jre-slim

ARG jar

RUN test -n "$jar"

# By default JVM will try to allocate 16GB heap, let's reduce its size a bit
ENV JAVA_TOOL_OPTIONS="-Xmx256m"

COPY $jar /app/app.jar

ENTRYPOINT ["java", "-jar", "/app/app.jar"]
7 changes: 4 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('global-jenkins-library@2.0.1') _
@Library('global-jenkins-library@2.5.0') _

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

Expand All @@ -9,7 +9,7 @@ buildJavaProject(
integrationTestsEnvVars: [],
shouldPublishJars: false,
shouldPublishDockerImages: true,
dockerfileDir: 'docker',
dockerfileDir: '.',
buildContext: '.',
dockerImageRepositoryName: repositoryName,
preProductionVisibility: 'docker.io',
Expand All @@ -19,5 +19,6 @@ sconeBuildUnlocked(
nativeImage: "docker-regis.iex.ec/$repositoryName:$buildInfo.imageTag",
imageName: repositoryName,
imageTag: buildInfo.imageTag,
sconifyArgsPath: './docker/sconify.args'
sconifyArgsPath: './docker/sconify.args',
sconifyVersion: '5.7.1'
)
66 changes: 37 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@
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 'jacoco'
id 'org.sonarqube' version '3.3'
id 'com.palantir.docker' version '0.26.0'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'io.freefair.lombok' version '5.3.0'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

ext {
gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
ociImageBase = 'nexus.intra.iex.ec/' + rootProject.name
ociImageBase = 'local/' + rootProject.name
ociImageName = ociImageBase + ':dev'
ociTeeImageName = ociImageBase + '-unlocked:dev'
jarPathForOCI = relativePath(tasks.shadowJar.outputs.files.singleFile)
mockitoVersion = '4.4.0'
systemStubsVersion = '2.0.1'
}

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'
}
Expand All @@ -34,6 +37,13 @@ repositories {
mavenLocal()
mavenCentral()
// iExec
maven {
url "https://docker-regis-adm.iex.ec/repository/maven-public/"
credentials {
username nexusUser
password nexusPassword
}
}
maven {
url "https://nexus.intra.iex.ec/repository/maven-public/"
}
Expand All @@ -46,6 +56,9 @@ dependencies {
// iexec
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"

// apache commons.lang3
implementation 'org.apache.commons:commons-lang3:3.12.0'

// test
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testImplementation 'org.assertj:assertj-core:3.18.1'
Expand All @@ -63,11 +76,17 @@ sourceSets {
}
}

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

tasks.withType(Tar).configureEach {
enabled = false
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
finalizedBy jacocoTestReport
useJUnitPlatform()
}
Expand All @@ -78,7 +97,7 @@ jacoco {
// sonarqube code coverage requires jacoco XML report
jacocoTestReport {
reports {
xml.enabled true
xml.required = true
}
}
tasks.sonarqube.dependsOn tasks.jacocoTestReport
Expand All @@ -100,38 +119,27 @@ jar {
}
}

def app = 'app'
def fatJar = "${app}-all.jar"

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

tasks.named('test') {
// Use junit platform for unit tests.
useJUnitPlatform()
}

docker {
name ociImageName
dockerfile file('docker/Dockerfile.local')
files('build/libs/' + fatJar)
buildArgs([JAR_PATH: fatJar])
}
tasks.docker.dependsOn tasks.build
ext.jarPathForOCI = relativePath(tasks.shadowJar.outputs.files.singleFile)

task buildImage {
dependsOn tasks.docker
task buildImage(type: 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) {
dependsOn buildImage
commandLine("sh", "-c", "IMG_FROM=$ociImageName IMG_TO=$ociTeeImageName " +
"./docker/sconify.sh " +
"&& docker run -e SCONE_HASH=1 $ociTeeImageName")
environment 'IMG_FROM', ociImageName
environment 'IMG_TO', ociTeeImageName
commandLine 'docker/sconify.sh'
}

task itest(type: Test) {
Expand Down
50 changes: 0 additions & 50 deletions docker/Dockerfile

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile.local

This file was deleted.

7 changes: 4 additions & 3 deletions docker/sconify.args
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
--name=tee-pre-compute \
--from=${IMG_FROM} \
--base=openjdk:11.0.16-jre-slim \
--to=${IMG_TO} \
--binary-fs \
--fs-dir=/app \
--host-path=/etc/hosts \
--host-path=/etc/resolv.conf \
--binary=/usr/lib/jvm/java-11-openjdk/bin/java \
--heap="4G" \
--dlopen="2" \
--binary=/usr/local/openjdk-11/bin/java \
--heap="3G" \
--dlopen="1" \
--verbose \
--no-color \
--command="java -jar /app/app.jar"
20 changes: 17 additions & 3 deletions docker/sconify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@
# 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

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

/bin/bash -c "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
registry.scontain.com:5050/scone-debug/iexec-sconify-image-unlocked:5.3.12 \
sconify_iexec $ARGS"
SCONE_IMAGE="registry.scontain.com:5050/${SCONE_IMG_NAME}:${SCONE_IMG_VERSION}"

/bin/bash -c "docker run -t --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
${SCONE_IMAGE} \
sconify_iexec \
--cli=${SCONE_IMAGE} \
--crosscompiler=${SCONE_IMAGE} \
$ARGS"

echo
docker run --rm -e SCONE_HASH=1 $IMG_TO
7 changes: 5 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
version=7.1.0
iexecCommonVersion=6.0.0
version=8.0.0
iexecCommonVersion=7.0.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,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 644dda4

Please sign in to comment.