Skip to content

Commit 26ffd15

Browse files
committed
Simpifying Daily-Maintenance.ps1
1 parent d0f25d6 commit 26ffd15

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

scripts/build-agents/Daily-Maintenance.ps1

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ if (Test-Path $lastExecutionFile) {
1616
}
1717
}
1818

19-
if ($shouldExecute) {
20-
Write-Host "Executing daily maintenance..."
21-
22-
# Update the last execution timestamp by touching the file
23-
"Last maintenance executed at $(Get-Date)" | Out-File $lastExecutionFile -Encoding UTF8
24-
25-
# Remove all Docker images that have not been used for 7 days.
26-
docker image prune -a --filter "until=168h" --force
19+
if (-not $shouldExecute) {
20+
exit 0
21+
}
2722

28-
# Pull this repo.
29-
git pull
30-
31-
Write-Host "Daily maintenance completed successfully."
32-
}
23+
Write-Host "Executing daily maintenance..."
24+
25+
# Update the last execution timestamp by touching the file
26+
"Last maintenance executed at $(Get-Date)" | Out-File $lastExecutionFile -Encoding UTF8
27+
28+
# Remove all Docker images that have not been used for 7 days.
29+
docker image prune -a --filter "until=168h" --force
30+
31+
# Pull this repo.
32+
git pull
33+
34+
Write-Host "Daily maintenance completed successfully."

0 commit comments

Comments
 (0)