Skip to content

Provide names for all artifact repositories #41857

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 3 commits into from
May 7, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ci/init.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
settings.pluginManagement {
repositories {
maven {
name "artifactory-gradle-plugins"
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
Expand All @@ -21,6 +22,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
buildscript {
repositories {
maven {
name "artifactory-gradle-release"
url "https://artifactory.elstc.co/artifactory/gradle-release/"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
Expand All @@ -31,6 +33,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
}
repositories {
maven {
name "artifactory-gradle-release"
url "https://artifactory.elstc.co/artifactory/gradle-release/"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ subprojects {
}
repositories {
maven {
name = 'localTest'
name = 'test'
url = "${rootProject.buildDir}/local-test-repo"
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if (project != rootProject) {
task integTest(type: Test) {
// integration test requires the local testing repo for example plugin builds
dependsOn project.rootProject.allprojects.collect {
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
it.tasks.matching { it.name == 'publishNebulaPublicationToTestRepository'}
}
dependsOn setupLocalDownloads
exclude "**/*Tests.class"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.gradle.api.artifacts.ModuleVersionIdentifier
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.ArtifactRepository
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.credentials.HttpHeaderCredentials
Expand Down Expand Up @@ -585,11 +586,11 @@ class BuildPlugin implements Plugin<Project> {
project.getRepositories().all { repository ->
if (repository instanceof MavenArtifactRepository) {
final MavenArtifactRepository maven = (MavenArtifactRepository) repository
assertRepositoryURIUsesHttps(project, maven.getUrl())
assertRepositoryURIUsesHttps(maven, project, maven.getUrl())
repository.getArtifactUrls().each { uri -> assertRepositoryURIUsesHttps(project, uri) }
} else if (repository instanceof IvyArtifactRepository) {
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository
assertRepositoryURIUsesHttps(project, ivy.getUrl())
assertRepositoryURIUsesHttps(ivy, project, ivy.getUrl())
}
}
RepositoryHandler repos = project.repositories
Expand All @@ -601,6 +602,7 @@ class BuildPlugin implements Plugin<Project> {
}
repos.jcenter()
repos.ivy {
name "elasticsearch"
url "https://artifacts.elastic.co/downloads"
patternLayout {
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
Expand Down Expand Up @@ -629,9 +631,9 @@ class BuildPlugin implements Plugin<Project> {
}
}

private static void assertRepositoryURIUsesHttps(final Project project, final URI uri) {
private static void assertRepositoryURIUsesHttps(final ArtifactRepository repository, final Project project, final URI uri) {
if (uri != null && uri.toURL().getProtocol().equals("http")) {
throw new GradleException("repository on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
throw new GradleException("repository [${repository.name}] on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class VagrantTestPlugin implements Plugin<Project> {
which should work for 5.0.0+. This isn't a real ivy repository but gradle
is fine with that */
repos.ivy {
name "elasticsearch"
artifactPattern "https://artifacts.elastic.co/downloads/elasticsearch/[module]-[revision].[ext]"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private void adaptBuildScriptForTest() throws IOException {
"buildscript {\n" +
" repositories {\n" +
" maven {\n" +
" name = \"test\"\n" +
" url = '" + getLocalTestRepoPath() + "'\n" +
" }\n" +
" }\n" +
Expand All @@ -117,12 +118,14 @@ private void adaptBuildScriptForTest() throws IOException {
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision");
if (luceneSnapshotRepo != null) {
luceneSnapshotRepo = " maven {\n" +
" name \"lucene-snapshots\"\n" +
" url \"https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision + "\"\n" +
" }\n";
}
writeBuildScript("\n" +
"repositories {\n" +
" maven {\n" +
" name \"test\"\n" +
" url \"" + getLocalTestRepoPath() + "\"\n" +
" }\n" +
" flatDir {\n" +
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/testKit/elasticsearch.build/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repositories {
jcenter()
repositories {
maven {
name "local-repo"
url System.getProperty("local.repo.path")
}
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/testKit/jarHell/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
jcenter()
repositories {
maven {
name "local"
url System.getProperty("local.repo.path")
}
}
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/testKit/testclusters/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ allprojects { all ->
dir System.getProperty("test.local-test-downloads-path")
}
maven {
name "local"
url System.getProperty("local.repo.path")
}
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision")
if (luceneSnapshotRevision != null) {
maven {
name "lucene-snapshots"
url "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision
}
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/testKit/thirdPartyAudit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repositories {
* - version 0.0.2 has the same class and one extra file just to make the jar different
*/
maven {
name = "local-test"
url = file("sample_jars/build/testrepo")
}
jcenter()
Expand Down
2 changes: 2 additions & 0 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ String hash = jdkVersionMatcher.group(4)
repositories {
// simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back
ivy {
name "legacy-jdk"
url "https://download.oracle.com"
metadataSources {
artifact()
Expand All @@ -247,6 +248,7 @@ repositories {
}
// current pattern since 12.0.1
ivy {
name "jdk"
url "https://download.oracle.com"
metadataSources {
artifact()
Expand Down
1 change: 1 addition & 0 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import java.util.regex.Pattern
buildscript {
repositories {
maven {
name "gradle-plugins"
url "https://plugins.gradle.org/m2/"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/java-api/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ For Gradle:
["source","groovy",subs="attributes"]
--------------------------------------------------
maven {
name "lucene-snapshots"
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/00142c9'
}
--------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/java-rest/high-level/getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ For Gradle:
["source","groovy",subs="attributes"]
--------------------------------------------------
maven {
name 'lucene-snapshots'
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835'
}
--------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/reference/setup/setup-xclient.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ repositories {

// Add the Elasticsearch Maven Repository
maven {
name "elastic"
url "https://artifacts.elastic.co/maven"
}
}
Expand Down
2 changes: 2 additions & 0 deletions qa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ subprojects { Project subproj ->
*/
repositories {
maven {
name "elastic"
url "https://artifacts.elastic.co/maven"
}
maven {
name "elastic-snapshots"
url "https://snapshots.elastic.co/maven"
}
}
Expand Down
1 change: 1 addition & 0 deletions qa/wildfly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int managementPort
repositories {
// the Wildfly distribution is not available via a repository, so we fake an Ivy repository on top of the download site
ivy {
name "wildfly"
url "https://download.jboss.org"
metadataSources {
artifact()
Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/java.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ repositories {

// Add the Elasticsearch Maven Repository
maven {
name "elastic"
url "https://artifacts.elastic.co/maven"
}
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/ml/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ esplugin {

repositories {
ivy {
name "prelert-artifacts"
name "ml-cpp"
url "https://prelert-artifacts.s3.amazonaws.com"
metadataSources {
// no repository metadata, look directly for the artifact
Expand Down
2 changes: 2 additions & 0 deletions x-pack/qa/rolling-upgrade-basic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)

repositories {
maven {
name "elastic"
url "https://artifacts.elastic.co/maven"
}
maven {
name "elastic-snapshots"
url "https://snapshots.elastic.co/maven"
}
}