mirror of https://github.com/hyperledger/besu
deprecate jenkins, update readme with circle status & added dist artifacts in ci (#207)
Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>pull/208/head
parent
e4e3057720
commit
58e7d2c2cf
@ -1,238 +0,0 @@ |
||||
#!/usr/bin/env groovy |
||||
|
||||
import hudson.model.Result |
||||
import hudson.model.Run |
||||
import jenkins.model.CauseOfInterruption.UserInterruption |
||||
|
||||
def shouldPublish() { |
||||
return env.BRANCH_NAME == 'master' || env.BRANCH_NAME ==~ /^release-\d+\.\d+/ |
||||
} |
||||
|
||||
def isSnapshotVersion(v) { |
||||
return (v ==~ /.*-SNAPSHOT/) |
||||
} |
||||
|
||||
if (shouldPublish()) { |
||||
properties([ |
||||
buildDiscarder( |
||||
logRotator( |
||||
daysToKeepStr: '30', artifactDaysToKeepStr: '7' |
||||
) |
||||
) |
||||
]) |
||||
} else { |
||||
properties([ |
||||
buildDiscarder( |
||||
logRotator( |
||||
numToKeepStr: '10' |
||||
) |
||||
) |
||||
]) |
||||
} |
||||
|
||||
def docker_image_dind = 'docker:18.06.0-ce-dind' |
||||
def docker_image = 'docker:18.06.0-ce' |
||||
def build_image = 'pegasyseng/pantheon-build:0.0.7-jdk11' |
||||
|
||||
def abortPreviousBuilds() { |
||||
Run previousBuild = currentBuild.rawBuild.getPreviousBuildInProgress() |
||||
|
||||
while (previousBuild != null) { |
||||
if (previousBuild.isInProgress()) { |
||||
def executor = previousBuild.getExecutor() |
||||
if (executor != null) { |
||||
echo ">> Aborting older build #${previousBuild.number}" |
||||
executor.interrupt(Result.ABORTED, new UserInterruption( |
||||
"Aborted by newer build #${currentBuild.number}" |
||||
)) |
||||
} |
||||
} |
||||
|
||||
previousBuild = previousBuild.getPreviousBuildInProgress() |
||||
} |
||||
} |
||||
|
||||
if (!shouldPublish()) { |
||||
abortPreviousBuilds() |
||||
} |
||||
|
||||
try { |
||||
timeout(time: 1, unit: 'HOURS') { |
||||
parallel DCOCheck: { |
||||
def stage_name = "DCO tests node: " |
||||
node { |
||||
checkout scm |
||||
docker.image(build_image).inside() { |
||||
stage(stage_name + 'Check') { |
||||
sh '''#!/bin/bash |
||||
status=0 |
||||
while IFS= read -r -a line; do |
||||
my_array+=( "$line" ) |
||||
done < <( git branch -r | grep -v origin/HEAD ) |
||||
for branch in "${my_array[@]}" |
||||
do |
||||
branch=$(echo "$branch" | xargs) |
||||
echo "Checking commits in branch $branch for commits missing DCO..." |
||||
while read -r results; do |
||||
status=1 |
||||
commit_hash="$(echo "$results" | cut -d' ' -f1)" |
||||
>&2 echo "$commit_hash is missing Signed-off-by line." |
||||
done < <(git log "$branch" --no-merges --pretty="%H %ae" --grep 'Signed-off-by' --invert-grep -- ) |
||||
done |
||||
exit $status |
||||
''' |
||||
} |
||||
} |
||||
} |
||||
}, UnitTests: { |
||||
def stage_name = "Unit tests node: " |
||||
node { |
||||
checkout scm |
||||
docker.image(docker_image_dind).withRun('--privileged') { d -> |
||||
docker.image(build_image).inside("--link ${d.id}:docker") { |
||||
try { |
||||
stage(stage_name + 'Prepare') { |
||||
sh './gradlew --no-daemon --parallel clean spotlessCheck compileJava compileTestJava assemble' |
||||
} |
||||
stage(stage_name + 'Unit tests') { |
||||
sh './gradlew --no-daemon --parallel build' |
||||
} |
||||
} finally { |
||||
archiveArtifacts '**/build/reports/**' |
||||
archiveArtifacts '**/build/test-results/**' |
||||
archiveArtifacts 'build/reports/**' |
||||
archiveArtifacts 'build/distributions/**' |
||||
|
||||
stash allowEmpty: true, includes: 'build/distributions/besu-*.tar.gz', name: 'distTarBall' |
||||
|
||||
junit '**/build/test-results/**/*.xml' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, ReferenceTests: { |
||||
def stage_name = "Reference tests node: " |
||||
node { |
||||
checkout scm |
||||
docker.image(docker_image_dind).withRun('--privileged') { d -> |
||||
docker.image(build_image).inside("--link ${d.id}:docker") { |
||||
try { |
||||
stage(stage_name + 'Prepare') { |
||||
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble' |
||||
} |
||||
stage(stage_name + 'Reference tests') { |
||||
sh './gradlew --no-daemon --parallel referenceTest' |
||||
} |
||||
} finally { |
||||
archiveArtifacts '**/build/reports/**' |
||||
archiveArtifacts '**/build/test-results/**' |
||||
archiveArtifacts 'build/reports/**' |
||||
archiveArtifacts 'build/distributions/**' |
||||
|
||||
junit '**/build/test-results/**/*.xml' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, IntegrationTests: { |
||||
def stage_name = "Integration tests node: " |
||||
node { |
||||
checkout scm |
||||
docker.image(docker_image_dind).withRun('--privileged') { d -> |
||||
docker.image(build_image).inside("--link ${d.id}:docker") { |
||||
try { |
||||
stage(stage_name + 'Prepare') { |
||||
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble' |
||||
} |
||||
stage(stage_name + 'Integration Tests') { |
||||
sh './gradlew --no-daemon --parallel integrationTest' |
||||
} |
||||
stage(stage_name + 'Check Licenses') { |
||||
sh './gradlew --no-daemon --parallel checkLicenses' |
||||
} |
||||
stage(stage_name + 'Check javadoc') { |
||||
sh './gradlew --no-daemon --parallel javadoc' |
||||
} |
||||
stage(stage_name + 'Compile Benchmarks') { |
||||
sh './gradlew --no-daemon --parallel compileJmh' |
||||
} |
||||
} finally { |
||||
archiveArtifacts '**/build/reports/**' |
||||
archiveArtifacts '**/build/test-results/**' |
||||
archiveArtifacts 'build/reports/**' |
||||
archiveArtifacts 'build/distributions/**' |
||||
|
||||
junit '**/build/test-results/**/*.xml' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, AcceptanceTests: { |
||||
def stage_name = "Acceptance tests node: " |
||||
node { |
||||
checkout scm |
||||
docker.image(docker_image_dind).withRun('--privileged') { d -> |
||||
docker.image(build_image).inside("--link ${d.id}:docker") { |
||||
try { |
||||
stage(stage_name + 'Prepare') { |
||||
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble' |
||||
} |
||||
stage(stage_name + 'Acceptance Tests') { |
||||
sh './gradlew --no-daemon --parallel acceptanceTest' |
||||
} |
||||
} finally { |
||||
archiveArtifacts '**/build/reports/**' |
||||
archiveArtifacts '**/build/test-results/**' |
||||
archiveArtifacts 'build/reports/**' |
||||
archiveArtifacts 'build/distributions/**' |
||||
|
||||
junit '**/build/test-results/**/*.xml' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
DockerImage: { |
||||
def stage_name = 'Docker image node: ' |
||||
def docker_folder = 'docker' |
||||
def reports_folder = docker_folder + '/reports' |
||||
def dockerfile = docker_folder + '/Dockerfile' |
||||
def version = '' |
||||
def image = '' |
||||
node { |
||||
checkout scm |
||||
docker.image(build_image).inside() { |
||||
stage(stage_name + 'Dockerfile lint') { |
||||
sh "docker run --rm -i hadolint/hadolint < ${dockerfile}" |
||||
} |
||||
|
||||
stage(stage_name + 'Build image') { |
||||
sh './gradlew distDocker' |
||||
} |
||||
|
||||
stage(stage_name + 'Calculate variables') { |
||||
def gradleProperties = readProperties file: 'gradle.properties' |
||||
version = gradleProperties.version |
||||
def imageRepos = 'hyperledger' |
||||
image = "${imageRepos}/besu:${version}" |
||||
} |
||||
|
||||
try { |
||||
stage(stage_name + 'Test image') { |
||||
sh "mkdir -p ${reports_folder}" |
||||
sh "cd ${docker_folder} && bash test.sh ${image}" |
||||
} |
||||
} finally { |
||||
archiveArtifacts "${reports_folder}/**" |
||||
junit "${reports_folder}/*.xml" |
||||
sh "rm -rf ${reports_folder}" |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
} catch (e) { |
||||
currentBuild.result = 'FAILURE' |
||||
} |
@ -1,61 +0,0 @@ |
||||
properties([ |
||||
parameters([ |
||||
string(name: 'BENCHMARK_GITHUB_ORG', defaultValue: 'PegaSysEng', description: 'The user or org from which to checkout the benchmark repo', trim: true), |
||||
string(name: 'BENCHMARK_REPO', defaultValue: 'pantheon-benchmark', description: 'The benchmark repo to be checked out', trim: true), |
||||
string(name: 'BENCHMARK_BRANCH', defaultValue: 'master', description: 'The benchmark branch to be checked out', trim: true), |
||||
choice(name: 'NETWORK', choices: ['rinkeby', 'ropsten', 'goerli', 'mainnet'], description: 'The name of the network being tested', trim: true), |
||||
|
||||
// For File Import |
||||
// choice(name: 'DATASET', choices: ['from-0-by-100k', 'from-0-to-1m', 'from-0', 'from-6784589'], description: 'Ropsten: choose from-0-by-100k or from-0-to-1m, Mainnet choose from-0 or from-from-6784589', trim: true), |
||||
// choice(name: 'IMPORT_FILE', choices: ['ropsten-000k-100k.blocks', 'ropsten-0-1M.blocks', '0-999.blocks', '6784590-6785589.blocks'], description: 'The name of the file to import, same ordial position as DATASET', trim: true) |
||||
|
||||
// For Network Import |
||||
choice(name: 'BESU_SYNC_MODE', choices: ['FULL', 'FAST'], description: 'The mode of network syncing to perform', trim: true), |
||||
string(name: 'BESU_MIN_PEERS', defaultValue: '2', description: 'Minimum number of peers to wait for before gathering data', trim: true), |
||||
string(name: 'BESU_BENCHMARK_DURATION', defaultValue: '30', description: 'Maximum number of minutes to run the benchmark (full sync ends the benchmark early)', trim: true), |
||||
]) |
||||
]) |
||||
|
||||
pipeline { |
||||
agent { |
||||
docker { |
||||
// For File Import |
||||
// image "pantheon-benchmarks/${params.NETWORK}-${params.DATASET}-pantheon:latest" |
||||
|
||||
// For Network Import |
||||
image "pantheon-benchmarks/mainnet-from-0-pantheon:latest" |
||||
|
||||
label 'jenkins-benchmark-1' |
||||
args '-v /benchmarks/block-import:/benchmarks-data' |
||||
} |
||||
} |
||||
|
||||
stages { |
||||
stage('Pull pantheon-benchmark') { |
||||
steps { |
||||
script { |
||||
// because of JENKINS-28447 we can't rely on late eval |
||||
def URL = 'git@github.com:' + params.BENCHMARK_GITHUB_ORG + '/' + params.BENCHMARK_REPO + '.git' |
||||
def branch = '*/' + params.BENCHMARK_BRANCH |
||||
checkout([$class: 'GitSCM', branches: [[name: branch]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'pantheon-benchmarks']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'f3f67c22-eead-47db-a8c1-fe32b483583a', url: URL]]]) |
||||
} |
||||
} |
||||
} |
||||
stage('Run benchmarks jenkinsfile') { |
||||
steps { |
||||
withEnv([ |
||||
"DATA_DIR=/data", |
||||
"BENCHMARKS_DATA=/benchmarks-data", |
||||
"BESU_SRC_DIR=${WORKSPACE}", |
||||
"DESCRIPTION=automatic" |
||||
]) { |
||||
dir('pantheon-benchmarks') { |
||||
script { |
||||
evaluate(readFile('jenkins/Jenkinsfile.pantheon-network-import')) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,117 +0,0 @@ |
||||
def runDocker(image, cmd) { |
||||
powershell """ |
||||
docker run ` |
||||
--rm ` |
||||
-w "${env.WORKSPACE}" ` |
||||
-v "${env.WORKSPACE}:${env.WORKSPACE}:rw" ` |
||||
-e "WORKSPACE=${env.WORKSPACE}" ` |
||||
-e "BUILD_NUMBER=${env.BUILD_NUMBER}" ` |
||||
$image powershell -C "$cmd" |
||||
""" |
||||
} |
||||
|
||||
def linuxImages = [ |
||||
'openjdk:11-jdk', |
||||
'adoptopenjdk/openjdk11-openj9:latest' |
||||
] |
||||
|
||||
def createLinuxBuild(dockerImage) { |
||||
return { |
||||
stage("Smoke ${dockerImage}") { |
||||
node { |
||||
checkout scm |
||||
docker.image(dockerImage).inside { |
||||
try { |
||||
timeout(30) { |
||||
sh './gradlew --no-daemon ' + params.gradle_options + ' build' |
||||
} |
||||
} finally { |
||||
junit testResults: '**/build/test-results/**/*.xml', allowEmptyResults: true |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
def linuxImagesPrivate = [ |
||||
'pegasyseng/jdk:oracle-11-0.0.1', |
||||
'pegasyseng/jdk:corretto-11-0.0.1', |
||||
'pegasyseng/jdk:openjdk-12', |
||||
'pegasyseng/jdk:zulu-openjdk-11', |
||||
'pegasyseng/jdk:zulu-openjdk-12' |
||||
] |
||||
|
||||
def createLinuxBuildPrivateImage(dockerImage) { |
||||
return { |
||||
stage("Smoke ${dockerImage}") { |
||||
node { |
||||
checkout scm |
||||
docker.withRegistry('https://registry.hub.docker.com', 'dockerhub-pegasysengci') { |
||||
docker.image(dockerImage).inside { |
||||
try { |
||||
timeout(30) { |
||||
sh './gradlew --no-daemon ' + params.gradle_options + ' build' |
||||
} |
||||
} finally { |
||||
junit testResults: '**/build/test-results/**/*.xml', allowEmptyResults: true |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
def windowsImages = [ |
||||
"openjdk:11-windowsservercore", |
||||
"openjdk:12-windowsservercore" |
||||
] |
||||
|
||||
def createWindowsBuild(dockerImage) { |
||||
return { |
||||
stage("Smoke ${dockerImage}") { |
||||
node("windows-server-2019") { |
||||
checkout scm |
||||
try { |
||||
timeout(30) { |
||||
runDocker( |
||||
dockerImage, |
||||
".\\gradlew --no-daemon " + params.gradle_options + " build" |
||||
) |
||||
} |
||||
} finally { |
||||
junit testResults: "**\\build\\test-results\\**\\*.xml", allowEmptyResults: true |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
def builds = [:] |
||||
|
||||
// disabling windows smoke tests till we upgrade ci |
||||
|
||||
if (params.javas != 'all') { |
||||
// builds = builds + (windowsImages.findAll {it.contains(params.javas)}.collectEntries { |
||||
// ["Smoke ${it}", createWindowsBuild(it)] |
||||
// }) |
||||
builds = builds + (linuxImages.findAll {it.contains(params.javas)}.collectEntries { |
||||
["Smoke ${it}", createLinuxBuild(it)] |
||||
}) |
||||
builds = builds + (linuxImagesPrivate.findAll {it.contains(params.javas)}.collectEntries { |
||||
["Smoke ${it}", createLinuxBuildPrivateImage(it)] |
||||
}) |
||||
} else { |
||||
// builds = builds + (windowsImages.collectEntries { |
||||
// ["Smoke ${it}", createWindowsBuild(it)] |
||||
// }) |
||||
builds = builds + (linuxImages.collectEntries { |
||||
["Smoke ${it}", createLinuxBuild(it)] |
||||
}) |
||||
builds = builds + (linuxImagesPrivate.collectEntries { |
||||
["Smoke ${it}", createLinuxBuildPrivateImage(it)] |
||||
}) |
||||
} |
||||
|
||||
parallel builds |
Loading…
Reference in new issue