Skip to content

Commit d9b5f2d

Browse files
Build: Cache Prometheus binary (opensearch-project#3261)
1 parent 0f197e5 commit d9b5f2d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

integ-test/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,15 @@ task startPrometheus(type: SpawnProcessTask) {
288288
mustRunAfter ':doctest:doctest'
289289

290290
doFirst {
291-
download.run {
292-
src getPrometheusBinaryLocation()
293-
dest new File("$projectDir/bin", 'prometheus.tar.gz')
291+
File prometheusFilePath = Paths.get("$projectDir/bin", "prometheus-${prometheus_binary_version}.tar.gz").toFile()
292+
if (!prometheusFilePath.exists()) {
293+
download.run {
294+
src getPrometheusBinaryLocation()
295+
dest prometheusFilePath
296+
}
294297
}
295298
copy {
296-
from tarTree("$projectDir/bin/prometheus.tar.gz")
299+
from tarTree("$projectDir/bin/prometheus-${prometheus_binary_version}.tar.gz")
297300
into "$projectDir/bin"
298301
}
299302
file("$projectDir/bin").eachDir {
@@ -310,7 +313,6 @@ task startPrometheus(type: SpawnProcessTask) {
310313
task stopPrometheus(type: KillProcessTask) {
311314
doLast {
312315
file("$projectDir/bin/prometheus").deleteDir()
313-
file("$projectDir/bin/prometheus.tar.gz").delete()
314316
}
315317
}
316318

0 commit comments

Comments
 (0)