Skip to content

Instantly share code, notes, and snippets.

@zot24
Last active August 29, 2015 14:10
Show Gist options
  • Save zot24/e64431892e10439d647b to your computer and use it in GitHub Desktop.
Save zot24/e64431892e10439d647b to your computer and use it in GitHub Desktop.
Jenkins CI Server – Resetting a build number and cleaning a build - http://goo.gl/WLlXYV
#
# Jenkins build cleaner
# Cleans out all builds for projects that exist in the directory
# Resets the build number to 1
# Backup all projects before running this
 
function cleanbuild {
 
echo "cleaning $1"
cd $1
ls -l
rm -Rf builds/*
rm -Rf lastSuccesful/
rm -Rf lastStable/
rm -Rf workspace/*
rm -Rf modules/*
rm -f lastSuccessful lastStable
rm -f nextBuildNumber
touch nextBuildNumber
echo 1 >> nextBuildNumber
cd -
}
 
for project in `find -L -maxdepth 1 -type d -name '*' ! -name '.*' -printf '%f\n' | column`
do
cleanbuild $project
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment