Skip to content

Commit

Permalink
Download certs from security plugin instead of storing local copy
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks committed Nov 5, 2024
1 parent 5cfdc3c commit 80e91ef
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
15 changes: 15 additions & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugins {
id 'jacoco'
id 'java-library'
id 'com.diffplug.spotless' version '6.25.0'
id 'de.undercouch.download' version '5.3.0'
}

ext {
Expand All @@ -29,6 +30,20 @@ ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE')

['sample.pem', 'test-kirk.jks'].forEach { file ->
File local = getLayout().getBuildDirectory().file(file).get().getAsFile()
download.run {
src "https://raw.githubusercontent.com/opensearch-project/security/refs/heads/main/bwc-test/src/test/resources/security/" + file
dest local
overwrite false
}
}

processTestResources {
from(getLayout().getBuildDirectory().file('sample.pem').get().getAsFile())
from(getLayout().getBuildDirectory().file('test-kirk.jks').get().getAsFile())
}
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE
if (Objects.nonNull(keystore)) {
URI uri = null;
try {
uri = this.getClass().getClassLoader().getResource("security/sample.pem").toURI();
uri = this.getClass().getClassLoader().getResource("sample.pem").toURI();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE
if (Objects.nonNull(keystore)) {
URI uri = null;
try {
uri = this.getClass().getClassLoader().getResource("security/sample.pem").toURI();
uri = this.getClass().getClassLoader().getResource("sample.pem").toURI();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
Expand Down
25 changes: 0 additions & 25 deletions plugin/src/test/resources/security/sample.pem

This file was deleted.

Binary file removed plugin/src/test/resources/security/test-kirk.jks
Binary file not shown.

0 comments on commit 80e91ef

Please sign in to comment.