Skip to content

Commit 7e1c858

Browse files
authored
Revert "Revert back to using DRA repository for ML artifacts on main branch (#100752)" (#109028) (#109124)
This reverts the changes in #100752. The issue with the artifacts-snapshots repository is that older artifacts are deleted, which means that you cannot build older branches of Elasticsearch due to missing artifacts. This reverts back to the S3-backed repository that keeps artifacts indefinitely. # Conflicts: # x-pack/plugin/ml/build.gradle
1 parent ac5c67a commit 7e1c858

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

x-pack/plugin/ml/build.gradle

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.elasticsearch.gradle.internal.info.BuildParams
12
import org.elasticsearch.gradle.VersionProperties
23
import org.elasticsearch.gradle.internal.dra.DraResolvePlugin
34
import org.elasticsearch.gradle.internal.info.BuildParams
@@ -15,42 +16,27 @@ esplugin {
1516
extendedPlugins = ['x-pack-autoscaling', 'lang-painless']
1617
}
1718

18-
def localRepo = providers.systemProperty('build.ml_cpp.repo').orNull
1919
if (useDra == false) {
2020
repositories {
2121
exclusiveContent {
22-
filter {
23-
includeGroup 'org.elasticsearch.ml'
24-
}
2522
forRepository {
2623
ivy {
2724
name "ml-cpp"
25+
url providers.systemProperty('build.ml_cpp.repo').orElse('https://prelert-artifacts.s3.amazonaws.com').get()
2826
metadataSources {
2927
// no repository metadata, look directly for the artifact
3028
artifact()
3129
}
32-
if (localRepo) {
33-
url localRepo
34-
patternLayout {
35-
artifact "maven/[orgPath]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
36-
}
37-
} else {
38-
url "https://artifacts-snapshot.elastic.co/"
39-
patternLayout {
40-
if (VersionProperties.isElasticsearchSnapshot()) {
41-
artifact '/ml-cpp/[revision]/downloads/ml-cpp/[module]-[revision]-[classifier].[ext]'
42-
} else {
43-
// When building locally we always use snapshot artifacts even if passing `-Dbuild.snapshot=false`.
44-
// Release builds are always done with a local repo.
45-
artifact '/ml-cpp/[revision]-SNAPSHOT/downloads/ml-cpp/[module]-[revision]-SNAPSHOT-[classifier].[ext]'
46-
}
47-
}
30+
patternLayout {
31+
artifact "maven/org/elasticsearch/ml/ml-cpp/[revision]/[module]-[revision](-[classifier]).[ext]"
4832
}
4933
}
5034
}
35+
filter {
36+
includeGroup 'org.elasticsearch.ml'
37+
}
5138
}
5239
}
53-
5440
}
5541

5642
configurations {
@@ -100,16 +86,21 @@ dependencies {
10086
api "org.apache.lucene:lucene-analysis-icu:${versions.lucene}"
10187
api "org.apache.lucene:lucene-analysis-kuromoji:${versions.lucene}"
10288
implementation 'org.ojalgo:ojalgo:51.2.0'
103-
nativeBundle("org.elasticsearch.ml:ml-cpp:${project.version}:deps@zip") {
89+
nativeBundle("org.elasticsearch.ml:ml-cpp:${mlCppVersion()}:deps@zip") {
10490
changing = true
10591
}
106-
nativeBundle("org.elasticsearch.ml:ml-cpp:${project.version}:nodeps@zip") {
92+
nativeBundle("org.elasticsearch.ml:ml-cpp:${mlCppVersion()}:nodeps@zip") {
10793
changing = true
10894
}
10995
testImplementation 'org.ini4j:ini4j:0.5.2'
11096
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
11197
}
11298

99+
def mlCppVersion(){
100+
return (project.gradle.parent != null && BuildParams.isSnapshotBuild() == false) ?
101+
(project.version + "-SNAPSHOT") : project.version;
102+
}
103+
113104
artifacts {
114105
// normal es plugins do not publish the jar but we need to since users need it for extensions
115106
archives tasks.named("jar")

0 commit comments

Comments
 (0)