Skip to content
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

Build: Cache Prometheus binary #3261

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
12 changes: 8 additions & 4 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,14 @@ task startPrometheus(type: SpawnProcessTask) {
mustRunAfter ':doctest:doctest'

doFirst {
download.run {
src getPrometheusBinaryLocation()
dest new File("$projectDir/bin", 'prometheus.tar.gz')
File downloadedPrometheus = Paths.get("$projectDir/bin", 'prometheus.tar.gz').toFile()
andy-k-improving marked this conversation as resolved.
Show resolved Hide resolved
if (!downloadedPrometheus.exists()) {
download.run {
src getPrometheusBinaryLocation()
dest new File("$projectDir/bin", 'prometheus.tar.gz')
}
} else {
println "Prometheus File Already Exists"
andy-k-improving marked this conversation as resolved.
Show resolved Hide resolved
}
copy {
from tarTree("$projectDir/bin/prometheus.tar.gz")
Expand All @@ -306,7 +311,6 @@ task startPrometheus(type: SpawnProcessTask) {
task stopPrometheus(type: KillProcessTask) {
doLast {
file("$projectDir/bin/prometheus").deleteDir()
file("$projectDir/bin/prometheus.tar.gz").delete()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can delete the tar.gz if it exists:

"prometheus-${prometheus_binary_version}.tar.gz"

Copy link
Contributor Author

@andy-k-improving andy-k-improving Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I'm thinking this differently, as if we keep this delete call with prometheus-versions.gz.
The module wouldn't be able to achieve the cache behaviour, because prometheus-versions.gz will always be absent during the next run of integ-test.startPrometheus( ).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...its the tar.gz that contains the version. Right. I was thinking we were checking for the binary.
Problem is that old tar.gz will stick around.
Can we make sure that all the prometheus files (tar.gz and binary) gets removed on a 'clean' call at least? We are currently calling stopPrometheus, but we can do something extra.

}
}

Expand Down
Loading