Skip to content

Commit

Permalink
Change workflow to keep JDBC repo, but refresh the branch. Update path.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Feb 1, 2023
1 parent d847404 commit 0b817f4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
42 changes: 26 additions & 16 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,35 @@ task stopPrometheus(type: KillProcessTask) {

stopPrometheus.mustRunAfter startPrometheus

task deleteJdbcDriverRepo {
// Delete local clone of the sql-jdbc repo
file("sql-jdbc").deleteDir()
}

task cloneJdbcDriverRepo {
doFirst {
file("sql-jdbc").deleteDir()

if (file("${buildDir}/sql-jdbc").exists()) {
exec {
// clone the sql-jdbc repo locally
commandLine 'git', 'clone', '--branch', System.getProperty("jdbcBranch", 'main'), System.getProperty('jdbcRepo', 'https://github.com/opensearch-project/sql-jdbc.git')
workingDir "${buildDir}/sql-jdbc"
commandLine 'git', 'remote', 'remove', 'origin'
}
exec {
workingDir "${buildDir}/sql-jdbc"
commandLine 'git', 'remote', 'add', 'origin', System.getProperty('jdbcRepo', 'https://github.com/opensearch-project/sql-jdbc.git')
}
// TODO would fail on windows
exec {
workingDir 'sql-jdbc'
commandLine 'sh', 'gradlew', 'shadowJar'
workingDir "${buildDir}/sql-jdbc"
commandLine 'git', 'fetch', 'origin'
}
exec {
workingDir "${buildDir}/sql-jdbc"
commandLine 'git', 'reset', '--hard', 'origin/' + System.getProperty("jdbcBranch", 'main')
}
} else {
exec {
workingDir buildDir
// clone the sql-jdbc repo locally
commandLine 'git', 'clone', '--branch', System.getProperty("jdbcBranch", 'main'), System.getProperty('jdbcRepo', 'https://github.com/opensearch-project/sql-jdbc.git')
}
}
// TODO would fail on windows
exec {
workingDir "${buildDir}/sql-jdbc"
commandLine 'sh', 'gradlew', 'shadowJar'
}
}

Expand Down Expand Up @@ -213,15 +224,14 @@ task integDevJdbcTest(type: RestIntegTestTask) {
}

if (System.getProperty("jdbcFile") != null) {
file("sql-jdbc/build/libs").mkdirs()
file("${buildDir}/sql-jdbc/build/libs").mkdirs()
copy {
from System.getProperty("jdbcFile")
into "sql-jdbc/build/libs"
into "${buildDir}/sql-jdbc/build/libs"
}
} else {
dependsOn cloneJdbcDriverRepo
}
finalizedBy deleteJdbcDriverRepo

systemProperty 'tests.security.manager', 'false'
systemProperty('project.root', project.projectDir.absolutePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void init() {
@BeforeClass
@SneakyThrows
public static void loadDriver() {
var buildDir = String.format("%s/sql-jdbc/build/libs", System.getProperty("project.root"));
var buildDir = String.format("%s/build/sql-jdbc/build/libs", System.getProperty("project.root"));
var driverFiles = new File(buildDir).
listFiles(pathname -> pathname.getAbsolutePath().endsWith(".jar"));

Expand Down

0 comments on commit 0b817f4

Please sign in to comment.