Build: Add task interdependencies for ssl configuration (#30633)

This commit fixes the tasks creating ssl certs for tests to have correct
dependsOn to ensure the right tasks are run before tests run.
This commit is contained in:
Ryan Ernst 2018-05-15 16:09:15 -07:00 committed by GitHub
parent 99b9ab58e2
commit c7d82b378b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 13 deletions

View File

@ -105,7 +105,7 @@ task exportNodeCertificate(type: LoggedExec) {
// Import the node certificate in the client's keystore // Import the node certificate in the client's keystore
task importNodeCertificateInClientKeyStore(type: LoggedExec) { task importNodeCertificateInClientKeyStore(type: LoggedExec) {
dependsOn exportNodeCertificate dependsOn createClientKeyStore, exportNodeCertificate
executable = new File(project.runtimeJavaHome, 'bin/keytool') executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import', args '-import',
'-alias', 'test-node', '-alias', 'test-node',
@ -137,7 +137,7 @@ task exportClientCertificate(type: LoggedExec) {
// Import the client certificate in the node's keystore // Import the client certificate in the node's keystore
task importClientCertificateInNodeKeyStore(type: LoggedExec) { task importClientCertificateInNodeKeyStore(type: LoggedExec) {
dependsOn exportClientCertificate dependsOn createNodeKeyStore, exportClientCertificate
executable = new File(project.runtimeJavaHome, 'bin/keytool') executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import', args '-import',
'-alias', 'test-client', '-alias', 'test-client',
@ -153,14 +153,10 @@ forbiddenPatterns {
// Add keystores to test classpath: it expects it there // Add keystores to test classpath: it expects it there
sourceSets.test.resources.srcDir(keystoreDir) sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn( processTestResources.dependsOn(importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore)
createNodeKeyStore, createClientKeyStore,
importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore
)
integTestCluster.dependsOn(importClientCertificateInNodeKeyStore, importNodeCertificateInClientKeyStore) integTestCluster.dependsOn(importClientCertificateInNodeKeyStore, importNodeCertificateInClientKeyStore)
ext.pluginsCount = 0 ext.pluginsCount = 0
project(':plugins').getChildProjects().each { pluginName, pluginProject -> project(':plugins').getChildProjects().each { pluginName, pluginProject ->
// need to get a non-decorated project object, so must re-lookup the project by path // need to get a non-decorated project object, so must re-lookup the project by path

View File

@ -74,6 +74,7 @@ task createClientKeyStore(type: LoggedExec) {
// Export the node's certificate // Export the node's certificate
File nodeCertificate = new File(keystoreDir, 'test-node.cert') File nodeCertificate = new File(keystoreDir, 'test-node.cert')
task exportNodeCertificate(type: LoggedExec) { task exportNodeCertificate(type: LoggedExec) {
dependsOn createNodeKeyStore
doFirst { doFirst {
if (nodeCertificate.parentFile.exists() == false) { if (nodeCertificate.parentFile.exists() == false) {
nodeCertificate.parentFile.mkdirs() nodeCertificate.parentFile.mkdirs()
@ -92,7 +93,7 @@ task exportNodeCertificate(type: LoggedExec) {
// Import the node certificate in the client's keystore // Import the node certificate in the client's keystore
task importNodeCertificateInClientKeyStore(type: LoggedExec) { task importNodeCertificateInClientKeyStore(type: LoggedExec) {
dependsOn exportNodeCertificate dependsOn createClientKeyStore, exportNodeCertificate
executable = new File(project.runtimeJavaHome, 'bin/keytool') executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import', args '-import',
'-alias', 'test-node', '-alias', 'test-node',
@ -105,6 +106,7 @@ task importNodeCertificateInClientKeyStore(type: LoggedExec) {
// Export the client's certificate // Export the client's certificate
File clientCertificate = new File(keystoreDir, 'test-client.cert') File clientCertificate = new File(keystoreDir, 'test-client.cert')
task exportClientCertificate(type: LoggedExec) { task exportClientCertificate(type: LoggedExec) {
dependsOn createClientKeyStore
doFirst { doFirst {
if (clientCertificate.parentFile.exists() == false) { if (clientCertificate.parentFile.exists() == false) {
clientCertificate.parentFile.mkdirs() clientCertificate.parentFile.mkdirs()
@ -123,7 +125,7 @@ task exportClientCertificate(type: LoggedExec) {
// Import the client certificate in the node's keystore // Import the client certificate in the node's keystore
task importClientCertificateInNodeKeyStore(type: LoggedExec) { task importClientCertificateInNodeKeyStore(type: LoggedExec) {
dependsOn exportClientCertificate dependsOn createNodeKeyStore, exportClientCertificate
executable = new File(project.runtimeJavaHome, 'bin/keytool') executable = new File(project.runtimeJavaHome, 'bin/keytool')
args '-import', args '-import',
'-alias', 'test-client', '-alias', 'test-client',
@ -139,10 +141,7 @@ forbiddenPatterns {
// Add keystores to test classpath: it expects it there // Add keystores to test classpath: it expects it there
sourceSets.test.resources.srcDir(keystoreDir) sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn( processTestResources.dependsOn(importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore)
createNodeKeyStore, createClientKeyStore,
importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore
)
integTestCluster.dependsOn(importClientCertificateInNodeKeyStore) integTestCluster.dependsOn(importClientCertificateInNodeKeyStore)