Skip to content

Commit

Permalink
Fixes issue with publishing Job Scheduler artifacts to correct maven …
Browse files Browse the repository at this point in the history
…coordinates (#377) (#378)

* Artifacts path update at right location

Signed-off-by: Varun Jain <varunudr@amazon.com>

* Artifacts path update at right location

Signed-off-by: Varun Jain <varunudr@amazon.com>

* Correct the order of task dependencies

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Disable POM validation

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Switch back to publishAllPublicationsToSnapshotsRepository

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add staging maven repo

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Varun Jain <varunudr@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Varun Jain <varunudr@amazon.com>
(cherry picked from commit db8edff)

Co-authored-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and cwperks authored May 5, 2023
1 parent 4e8cc09 commit 2885265
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 36 deletions.
105 changes: 70 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
}

plugins {
id 'com.netflix.nebula.ospackage' version "11.0.0"
id 'com.netflix.nebula.ospackage' version "11.3.0"
id 'java-library'
id "com.diffplug.spotless" version "6.17.0" apply false
}
Expand Down Expand Up @@ -52,7 +52,37 @@ forbiddenApisTest.ignoreFailures = true
validateNebulaPom.enabled = false
loggerUsageCheck.enabled = false

tasks.matching {it.path in [":publishNebulaPublicationToSnapshotsRepository"]}.all { task ->
// Order is publish nebula, then jar then zip

tasks.whenTaskAdded {task ->
if(task.name.contains("validatePluginJarPom") || task.name.contains("validatePluginZipPom")) {
task.enabled = false
}
}

tasks.matching {it.path in [
":generatePomFileForPluginJarPublication"
]}.all { task ->
task.mustRunAfter 'publishNebulaPublicationToMavenLocal', 'publishNebulaPublicationToSnapshotsRepository', 'publishNebulaPublicationToStagingRepository'
}

tasks.matching {it.path in [
":publishPluginJarPublicationToMavenLocal",
":validatePluginJarPom"
]}.all { task ->
task.dependsOn 'generatePomFileForPluginJarPublication'
}

tasks.matching {it.path in [
":generatePomFileForPluginZipPublication"
]}.all { task ->
task.mustRunAfter 'publishPluginJarPublicationToMavenLocal', 'publishPluginJarPublicationToSnapshotsRepository', 'publishPluginJarPublicationToStagingRepository'
}

tasks.matching {it.path in [
":publishPluginZipPublicationToMavenLocal",
":validatePluginZipPom"
]}.all { task ->
task.dependsOn 'generatePomFileForPluginZipPublication'
}

Expand Down Expand Up @@ -93,48 +123,49 @@ allprojects {
// Default to the apache license
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
plugins.withType(ShadowPlugin).whenPluginAdded {
publishing {
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
}
publications {
// add license information to generated poms
all {
pom {
name = "opensearch-job-scheduler"
description = "OpenSearch Job Scheduler plugin"
groupId = "org.opensearch.plugin"
}
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/job-scheduler')
}
}
}
}
}
}

publishing {
publications {
pluginZip(MavenPublication) { publication ->
pluginZip(MavenPublication) {
pom {
name = "opensearch-job-scheduler"
description = "OpenSearch Job Scheduler plugin"
packaging = "zip"
groupId = "org.opensearch.plugin"
}
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/job-scheduler')
}
}
pluginJar(MavenPublication){
pom {
name = "opensearch-job-scheduler"
description = "OpenSearch Job Scheduler plugin"
packaging = "jar"
groupId = "org.opensearch"
}
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/job-scheduler')
}
}
}
repositories {
Expand All @@ -146,6 +177,10 @@ publishing {
password "$System.env.SONATYPE_PASSWORD"
}
}
maven {
name = 'Staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
}
}

Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ project(":spi").name = rootProject.name + "-spi"

include "sample-extension-plugin"
project(":sample-extension-plugin").name = rootProject.name + "-sample-extension"
startParameter.excludedTaskNames=["publishPluginZipPublicationToMavenLocal", "publishPluginZipPublicationToStagingRepository"]

0 comments on commit 2885265

Please sign in to comment.