Skip to content

Commit

Permalink
Fix deleting old builds not working
Browse files Browse the repository at this point in the history
Use a single find command with -regex instead of find piped into grep.

Fix the regex to match commit hashes used in the file names with 7 or
more hex chars. Git will increase the hashes' length to ensure they are
unique, and currently they are 9 chars long.

Fixes #34402
  • Loading branch information
dregad committed Apr 11, 2024
1 parent 66744f8 commit 9082850
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nightly-builds.sh
Expand Up @@ -135,15 +135,15 @@ log "Branches found: $expanded_branches"

# Remove any builds not part of the branches list
log "Deleting old builds not part of branches list"
find $pathBuilds -maxdepth 1 -name 'mantisbt*' |
grep -vE -- "-(${expanded_branches//,/|})-[0-9a-f]{7}\" |
xargs --no-run-if-empty rm -rv 2>&1 |tee -a "$logfile"
find $pathBuilds -maxdepth 1 -name 'mantisbt*' -regextype egrep \
! -regex ".*-(${expanded_branches//,/|})-[0-9a-f]{7,}\..*" -print0 |
xargs -0 --no-run-if-empty rm -rv 2>&1 |tee -a "$logfile"

# Build the tarballs
log "Generating nightly builds for branches: $expanded_branches"
# Prefixing each branch name with remote
refList=$(eval echo "$remote/{$expanded_branches}")
$pathTools/buildrelease-repo.py --auto-suffix --ref "${refList// /,}" --fresh --clean $pathBuilds 2>&1 |tee -a "$logfile"
echo $pathTools/buildrelease-repo.py --auto-suffix --ref "${refList// /,}" --fresh --clean $pathBuilds 2>&1 |tee -a "$logfile"
echo >>"$logfile"


Expand Down

0 comments on commit 9082850

Please sign in to comment.