Skip to content

Instantly share code, notes, and snippets.

@bmcmurray
Created October 15, 2012 20:30
Show Gist options
  • Save bmcmurray/3895214 to your computer and use it in GitHub Desktop.
Save bmcmurray/3895214 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Make a static clone the working copy of a Jenkins build
# to a public directory for browser testing.
# Also cleans clones older than 14 days
#
# Parameters:
# $1: Publish target (absolute path, without "$1")
# $2: ID to use for the static clone directory
#
# Usage:
# From within the Jenkins working copy directory.
#
# version 3 (2012-06-07)
dest="/Users/bmcmurray/jq-testswarm/build"
echo "Creating a static clone of the current directory."
echo "Group: $1"
echo "Copy ID: $2"
mkdir $dest/$1
mkdir $dest/$1/$2
echo "Copying... to " $dest/$1/$2
rsync -a --exclude=".git*" . $dest/$1/$2
echo "Cleaning up outdated copies"
cd $dest/$1
find . -maxdepth 1 -ctime +14 | grep -v master | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment