Skip to content
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

SOLR-16880: Add OAS to 'assembleRelease' task #2125

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions dev-tools/scripts/smokeTestRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def checkSigs(urlString, version, tmpDir, isSigned, keysFile):
ents = getDirEntries(urlString)
artifact = None
changesURL = None
openApiURL = None
mavenURL = None
dockerURL = None
artifactURL = None
Expand All @@ -243,6 +244,10 @@ def checkSigs(urlString, version, tmpDir, isSigned, keysFile):
if text not in ('changes/', 'changes-%s/' % version):
raise RuntimeError('solr: found %s vs expected changes-%s/' % (text, version))
changesURL = subURL
elif text.startswith('openApi'):
if text not in ('openApi/', 'openApi-%s/' % version):
raise RuntimeError('solr: found %s vs expected openApi-%s/' % (text, version))
openApiURL = subURL
elif artifact is None:
artifact = text
artifactURL = subURL
Expand Down Expand Up @@ -296,6 +301,12 @@ def checkSigs(urlString, version, tmpDir, isSigned, keysFile):
raise RuntimeError('solr is missing changes-%s' % version)
testChanges(version, changesURL)

if openApiURL is None:
stopGpgAgent(gpgHomeDir, logfile)
raise RuntimeError('solr is missing OpenAPI specification' % version)
testOpenApi(version, openApiURL)


for artifact, urlString in artifacts: # pylint: disable=redefined-argument-from-local
print(' download %s...' % artifact)
scriptutil.download(artifact, urlString, tmpDir, force_clean=FORCE_CLEAN)
Expand Down Expand Up @@ -349,6 +360,17 @@ def testChanges(version, changesURLString):
s = load(changesURL)
checkChangesContent(s, version, changesURL, True)

def testOpenApi(version, openApiDirUrl):
print(' check OpenAPI specification...')
specFound = False
expectedSpecFileName = 'solr-openapi-' + version + '.json'
for text, subURL in getDirEntries(openApiDirUrl):
if text == expectedSpecFileName:
specFound = True

if not specFound:
raise RuntimeError('Did not see %s in %s' % expectedSpecFileName, openApiDirUrl)


def testChangesText(dir, version):
"Checks all CHANGES.txt under this dir."
Expand Down
3 changes: 3 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ Other Changes

* SOLR-16949: Restrict certain file types from being uploaded to or downloaded from Config Sets (janhoy, Houston Putman)

* SOLR-16880: Solr now produces an OpenAPI Specification artifact on releases ("solr-openapi-x.y.z.json") that covers
Solr's v2 APIs. (Jason Gerlowski, Houston Putman)

================== 9.4.0 ==================
New Features
---------------------
Expand Down
5 changes: 3 additions & 2 deletions solr/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ext {
jsClientDir = "${buildDir}/generated/js"
pythonClientDir = "${buildDir}/generated/python"
openApiSpecDir = "${buildDir}/generated/openapi"
openApiSpecFile = "${project.openApiSpecDir}/openapi.json"
openApiSpecFile = "${project.openApiSpecDir}/solr-openapi-${version}.json"
}

configurations {
Expand All @@ -50,6 +50,7 @@ resolve {
classpath = sourceSets.main.runtimeClasspath
resourcePackages = ["org.apache.solr.client.api.util", "org.apache.solr.client.api.endpoint"]
outputDir = file(project.openApiSpecDir)
outputFileName = "solr-openapi-${version}"
prettyPrint = true
}

Expand Down Expand Up @@ -91,7 +92,7 @@ tasks.withType(org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {

artifacts {
// Ensure the OAS is available to other modules who want to generate code (i.e. solrj)
openapiSpec resolve.outputDir, {
openapiSpec file(openApiSpecFile), {
builtBy resolve
}

Expand Down
35 changes: 32 additions & 3 deletions solr/distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ apply from: buildscript.sourceFile.toPath().resolveSibling("source-release.gradl
// Set up the HTML-rendered "changes" distribution artifact by linking to documentation's output.
configurations {
changesHtml
openApiSpecFile
docker
}

dependencies {
changesHtml project(path: ":solr:documentation", configuration: "changesHtml")
openApiSpecFile project(path: ":solr:api", configuration: "openapiSpec")
docker project(path: ':solr:docker', configuration: 'packagingOfficial')
}

Expand All @@ -73,11 +75,13 @@ task computeChecksums(type: Checksum) {
[
tasks.assembleSourceTgz,
fullDistTarTask,
slimDistTarTask,
slimDistTarTask
].each { dep ->
dependsOn dep
files += dep.outputs.files
}
dependsOn configurations.openApiSpecFile
files += configurations.openApiSpecFile

outputDir = file("${buildDir}/checksums")
}
Expand All @@ -93,11 +97,19 @@ task signSourceTgz(type: Sign) {
dependsOn tasks.assembleSourceTgz
sign tasks.assembleSourceTgz.destination
}
task signOpenApiSpec(type: Sign) {
dependsOn configurations.openApiSpecFile
// This is not an artifact, so we need to use "file" not "configuration" signing
doFirst {
sign configurations.openApiSpecFile.singleFile
}
}

task signReleaseArchives(type: Sync) {
from tasks.signFullBinaryTgz
from tasks.signSlimBinaryTgz
from tasks.signSourceTgz
from tasks.signOpenApiSpec

into "${buildDir}/signatures"
}
Expand Down Expand Up @@ -125,6 +137,10 @@ task assembleRelease(type: Sync) {
into "changes"
})

from(configurations.openApiSpecFile, {
into "openApi"
})

from(configurations.docker, {
include 'Dockerfile.official*'
into "docker"
Expand All @@ -139,11 +155,24 @@ task assembleRelease(type: Sync) {
from fullDistTarTask
from slimDistTarTask

from tasks.computeChecksums
from(tasks.computeChecksums, {
exclude { it.file.getName().contains("openapi") }
})
from(tasks.computeChecksums, {
include { it.file.getName().contains("openapi") }
into "openApi"
})

// Conditionally, attach signatures of all the release archives.
if (project.ext.withSignedArtifacts) {
from tasks.signReleaseArchives
from(tasks.signReleaseArchives, {
exclude { it.file.getName().contains("openapi") }
})

from(tasks.signReleaseArchives, {
include { it.file.getName().contains("openapi") }
into "openApi"
})
}

into releaseDir
Expand Down