-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes IT failures that frequently occur after version bumps due to missing unified release snapshot builds for the new version. This commit uses project specific DRA snapshot URLs for ES and Filebeat in all cases apart from release builds. Closes #2825
- Loading branch information
Showing
2 changed files
with
85 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
buildSrc/src/main/groovy/org/logstash/gradle/tooling/SnapshotArtifactURLs.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.logstash.gradle.tooling | ||
|
||
import groovy.json.JsonSlurper | ||
|
||
/** | ||
* Helper class to obtain project specific (e.g. Elasticsearch or beats/filebeat) snapshot-DRA artifacts. | ||
* We use it in all cases apart from release builds. | ||
* */ | ||
class SnapshotArtifactURLs { | ||
/** | ||
* Returns a list of the package and package SHA(512) URLs for a given project / version / downloadedPackageName | ||
* */ | ||
static def packageUrls(String project, String projectVersion, String downloadedPackageName) { | ||
String artifactSnapshotVersionsApiPrefix = "https://artifacts-snapshot.elastic.co" | ||
|
||
// e.g. https://artifacts-snapshot.elastic.co/elasticsearch/latest/8.11.5-SNAPSHOT.json | ||
String apiResponse = "${artifactSnapshotVersionsApiPrefix}/${project}/latest/${projectVersion}.json".toURL().text | ||
def artifactUrls = new JsonSlurper().parseText(apiResponse) | ||
String manifestUrl = artifactUrls["manifest_url"] | ||
// e.g. https://artifacts-snapshot.elastic.co/elasticsearch/8.11.5-12345678/manifest-8.11.5-SNAPSHOT.json | ||
apiResponse = manifestUrl.toURL().text | ||
def packageArtifactUrls = new JsonSlurper().parseText(apiResponse) | ||
String packageUrl = packageArtifactUrls["projects"]["${project}"]["packages"]["${downloadedPackageName}.tar.gz"]["url"] | ||
String packageShaUrl = packageArtifactUrls["projects"]["${project}"]["packages"]["${downloadedPackageName}.tar.gz"]["sha_url"] | ||
|
||
return [packageUrl, packageShaUrl] | ||
|
||
} | ||
} |