Publish jars to Azure (#22)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/26/head
Adrian Sutton 5 years ago committed by GitHub
parent 3eb904609d
commit 08fd8ddede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      Jenkinsfile
  2. 52
      build.gradle

32
Jenkinsfile vendored

@ -251,7 +251,7 @@ exit $status
}
}
}, BintrayPublish: {
def stage_name = "Bintray publish node: "
def stage_name = "Publish distributions: "
def version = ''
node {
if (shouldPublish()) {
@ -288,8 +288,36 @@ exit $status
}
}
}
}, AzurePublish: {
def stage_name = "Publish jars: "
def version = ''
node {
if (shouldPublish()) {
checkout scm
docker.image(docker_image_dind).withRun('--privileged') { d ->
docker.image(build_image).inside("--link ${d.id}:docker") {
stage(stage_name + 'Prepare') {
sh './gradlew --no-daemon --parallel clean assemble'
}
stage(stage_name + 'Publish') {
withCredentials([
usernamePassword(
credentialsId: 'hyperledger-azure',
usernameVariable: 'AZURE_USER',
passwordVariable: 'AZURE_KEY'
)
]) {
sh './gradlew --no-daemon --parallel publish'
}
}
}
}
}
}
}
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
} finally {

@ -85,6 +85,10 @@ def bintrayPackage = bintray.pkg {
}
}
def azureUser = "AZURE_ARTIFACTS"
def azureKey = project.hasProperty('azureApiKey') ? project.property('azureApiKey') : System.getenv('AZURE_KEY')
def artifactRepoUrl = 'https://pkgs.dev.azure.com/Hyperledger/Besu/_packaging/besu/maven/v1'
allprojects {
apply plugin: 'java-library'
apply plugin: 'io.spring.dependency-management'
@ -119,11 +123,13 @@ allprojects {
if ("$System.env.JENKINS_URL" == 'https://jenkins.pegasys.tech/') {
maven { url "https://nexus.int.pegasys.tech/repository/consensys-pegasys/" }
maven { url "https://nexus.int.pegasys.tech/repository/jcenter/" }
maven { url artifactRepoUrl }
} else {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://consensys.bintray.com/pegasys-repo" }
maven { url artifactRepoUrl }
}
}
@ -314,6 +320,16 @@ subprojects {
apply plugin: 'maven-publish'
publishing {
repositories {
maven {
url artifactRepoUrl
credentials {
username azureUser
password azureKey
}
}
}
publications {
mavenJava(MavenPublication) {
groupId "org.hyperledger.besu.internal"
@ -349,18 +365,6 @@ subprojects {
}
}
}
bintray {
user = bintrayUser
key = bintrayKey
publications = ['mavenJava']
override = version.endsWith('SNAPSHOT')
publish = true
pkg = bintrayPackage
}
}
tasks.withType(Test) {
@ -616,6 +620,27 @@ tasks.register("verifyDistributions") {
}
}
apply plugin: 'maven-publish'
publishing {
repositories {
maven {
url artifactRepoUrl
credentials {
username azureUser
password azureKey
}
}
}
publications {
maven(MavenPublication) {
artifact source: distTar.outputs.files.singleFile, extension: 'tar.gz'
artifact source: distZip.outputs.files.singleFile, extension: 'zip'
version "${project.version}"
}
}
}
bintray {
user = bintrayUser
key = bintrayKey
@ -633,6 +658,9 @@ bintray {
}
build.dependsOn verifyDistributions
publish.dependsOn verifyDistributions
publish.mustRunAfter(distTar)
publish.mustRunAfter(distZip)
bintrayUpload.dependsOn verifyDistributions
bintrayUpload.mustRunAfter(distTar)
bintrayUpload.mustRunAfter(distZip)

Loading…
Cancel
Save