-
Notifications
You must be signed in to change notification settings - Fork 216
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
Delete older than 14 days #3050
Conversation
// Sanity check not to delete anything else | ||
if (!pathToDelete.contains("c:\\pr-")) { | ||
if (!pathToDelete.contains("C:\\PR-")) { |
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.
why those fixes? does it mean we never deleted directories after PR is closed?
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.
I have added changes to make sure its uppercase.
command = 'forfiles /P c:\\ /D -14 | grep -oE "(PR-[0-9]*)"' | ||
status = bat(returnStatus: true, script: command) | ||
if ( status != 0) { | ||
println "No PR-XXXX older than 14 days for cleanup." |
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.
will one be re-created when someone continues the work on 14 days old PR?
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.
Yes, It will take longer as the bazel cache will need to be downloaded once again.
@@ -11,7 +13,7 @@ def cleanup_directories() { | |||
println existing_workspace_string | |||
def existing_workspace = existing_workspace_string.split(/\n/) | |||
|
|||
command = 'ls c:\\ | grep -oE "(pr-[0-9]*)$"' | |||
command = 'ls c:\\ | grep -oE "(PR-[0-9]*)$"' |
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.
if we have no idea why pr changed to PR, then its good to consider both options in all scripts
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.
Added toUpper from jenkins env.
ci/loadWin.groovy
Outdated
for (int i = 0; i < existing_prs.size(); i++) { | ||
// Check for empty output, Part of output contains the command that was run | ||
if ( existing_prs[i] == null || existing_prs[i].allWhitespace || existing_prs[i].toLowerCase().contains("grep")) { continue } | ||
// Check if directory was created more than 14 days ago |
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.
Why is this comment here? Doesn't existing_prs
contain only 14 days long dirs?
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.
Windows command return the executed command and forfiles as a loop returns empty/null string at the beginning and end of output.
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.
resp
🛠 Summary
JIRA [CVS-161260
Delete PR-XXXX older than 14 days on jenkins nodes.
🧪 Checklist
``