You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our CI pipeline builds feature branches using autoclose gates. It is expected that builds on feature branches fail from time to time and may be corrected by developers. This leaves autoclose gates open and "stranded".
When processing autoclose items, the gate resource should probably perform a cleanup of gates after a configurable TTL. Thinking of it, there might be value to having a TTL for gates in general (i.e. reduced git checkout size and less load on the filesystem). This might be best delegated to a "sidecar" task that runs on the gate-repo
The text was updated successfully, but these errors were encountered:
I've experimented with a script like this to clean up gate files older than 7 days
#!/bin/bashset -o errexit
set -o errtrace
set -o pipefail
set -o nounset
functioncleanup()
{
stamp=$(date +%s)
day=$((60*60*24))
old=$(($stamp-7*$day))echo"cleaning any file commited older than $old"whileread FILE;do
modified=$(git log --pretty="%ad" --date=unix -1 -- "$FILE")if [ $modified-lt$old ];thenecho"$FILE$modified is old, cleaning"
rm "$FILE"elseecho"$FILE$modified is not old"fi;done<<( git ls-files )
}
cleanup
When commiting to the gate repository, use something like git commit -am "[ci skip] cleanup old gates" so that the commit is not picked up accidentally as a valid gate-modifying commit. Otherwise you'll see errors like could not determine passed file in version ... in your gate resources.
Our CI pipeline builds feature branches using autoclose gates. It is expected that builds on feature branches fail from time to time and may be corrected by developers. This leaves autoclose gates open and "stranded".
When processing autoclose items, the gate resource should probably perform a cleanup of gates after a configurable TTL. Thinking of it, there might be value to having a TTL for gates in general (i.e. reduced git checkout size and less load on the filesystem). This might be best delegated to a "sidecar" task that runs on the gate-repo
The text was updated successfully, but these errors were encountered: