-
Notifications
You must be signed in to change notification settings - Fork 142
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
base: main
Are you sure you want to change the base?
Build: Cache Prometheus binary #3261
Conversation
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should ensure that the Prometheus download is cleared on a clean
call - so that the developers don't need to manually delete this to clean up their state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx!
Thx both, I will update this to cache the last version only. |
Signed-off-by: Andy Kwok <[email protected]>
e929ac5
@YANG-DB @acarbonetto @penghuo I have updated the code to only re-use Prometheus binary when it matches the version. |
@@ -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() |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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( )
.
Signed-off-by: Andy Kwok <[email protected]>
Description
As per the current design of Gradle test workflow, Gradle task
startPrometheus
is designed to execute upon every integration test and docTest.However the current implementation of
startPrometheus
andstopPrometheus
will force and trigger the re-download ofPrometheus
binary, no matter that is a first run or subsequent run. (~100 Mb)This result in waste of bandwidth and reduce on developer productivity, as integration test will be executed frequently during the typical development process.
Hence this is a PR to introduce FileExistCheck to only download Prometheus binary when it's absent.
Test plan:
integTest
and make surePrometheus File Already Exists
printed on console and no additional files being downloaded on subsequent IT test execution.Related Issues
Resolves #3257
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.