zot24
12/2/2014 - 10:23 AM

Jenkins CI Server – Resetting a build number and cleaning a build - http://goo.gl/WLlXYV

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