Skip to content

Add Artifactory Publishing #1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ jobs:
- run:
name: Publish
command: |
./gradlew --no-daemon bintrayUpload
./gradlew --no-daemon artifactoryPublish bintrayUpload

publishDocker:
executor: besu_executor_med
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Additions and Improvements
* Added `besu_transaction_pool_transactions` to the reported metrics, counting the mempool size [\#1869](https://github.com/hyperledger/besu/pull/1869)
* Distributions and maven artifacts have been moved off of bintray [\#1886](https://github.com/hyperledger/besu/pull/1886)

### Bug Fixes

Expand Down
67 changes: 65 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ plugins {
id 'com.diffplug.spotless' version '5.9.0'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.github.hierynomus.license' version '0.15.0'
id 'com.jfrog.artifactory' version '4.20.0'
id 'com.jfrog.bintray' version '1.8.5'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'me.champeau.gradle.jmh' version '0.5.0' apply false
id 'net.ltgt.errorprone' version '1.3.0'
id 'maven-publish'
}

if (!JavaVersion.current().java11Compatible) {
Expand Down Expand Up @@ -122,7 +124,7 @@ allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://hyperledger.jfrog.io/hyperledger/besu-maven" }
maven { url "https://hyperledger-org.bintray.com/besu-repo" }
maven { url "https://consensys.bintray.com/pegasys-repo" }
maven { url "https://consensys.bintray.com/consensys" }
Expand Down Expand Up @@ -281,7 +283,7 @@ task checkMavenCoordinateCollisions {
doLast {
def coordinates = [:]
getAllprojects().forEach {
if (it.properties.containsKey('publishing')) {
if (it.properties.containsKey('publishing') && it.jar?.enabled) {
def coordinate = it.publishing?.publications[0].coordinates
if (coordinates.containsKey(coordinate)) {
throw new GradleException("Duplicate maven coordinates detected, ${coordinate} is used by " +
Expand Down Expand Up @@ -365,6 +367,7 @@ subprojects {
}

if (sourceSetIsPopulated("main") || sourceSetIsPopulated("testSupport")) {
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

Expand Down Expand Up @@ -416,6 +419,27 @@ subprojects {

pkg = bintrayPackage
}

def artifactoryUser = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : System.getenv('ARTIFACTORY_USER')
def artifactoryKey = project.hasProperty('artifactoryApiKey') ? project.property('artifactoryApiKey') : System.getenv('ARTIFACTORY_KEY')
def artifactoryRepo = System.getenv('ARTIFACTORY_REPO') ?: 'besu-maven'
def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger'

artifactory {
contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}"
publish {
repository {
repoKey = "${artifactoryRepo}"
username = artifactoryUser
password = artifactoryKey
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
}
}
}
}

tasks.withType(Test) {
Expand Down Expand Up @@ -549,6 +573,45 @@ distZip {
}
}

publishing {
publications {
distArtifactory(MavenPublication) {
groupId (version.contains('SNAPSHOT') ? 'SNAPSHOT' : '.')
version = project.version
artifactId = 'besu-distribution'
artifact("$buildDir/distributions/besu-${project.version}.zip")
artifact("$buildDir/distributions/besu-${project.version}.tar.gz") {
extension = 'tar.gz'
}
}
}
}

def artifactoryUser = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : System.getenv('ARTIFACTORY_USER')
def artifactoryKey = project.hasProperty('artifactoryApiKey') ? project.property('artifactoryApiKey') : System.getenv('ARTIFACTORY_KEY')
def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger'

artifactory {
contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}"
publish {
repository {
repoKey = "besu-binaries"
username = artifactoryUser
password = artifactoryKey
}
defaults {
publications('distArtifactory')
publishArtifacts = true
publishPom = false
}
}
}

artifactoryPublish {
dependsOn distTar
dependsOn distZip
}

def dockerVariants = [
"openjdk-11",
"graalvm",
Expand Down