From 90723bb53d660e290b5c9ccacf3b403fd99c412a Mon Sep 17 00:00:00 2001
From: David Baumgold <david@davidbaumgold.com>
Date: Mon, 5 May 2014 15:53:25 -0400
Subject: [PATCH] Reset the jenkins ruby environment before tests run

---
 jenkins/acceptance.sh | 7 +++++++
 jenkins/all-tests.sh  | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/jenkins/acceptance.sh b/jenkins/acceptance.sh
index 8bcaa209fff..6ea6b0222ea 100755
--- a/jenkins/acceptance.sh
+++ b/jenkins/acceptance.sh
@@ -51,6 +51,13 @@ mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSibli
 # not already be fetched.
 git fetch origin master:refs/remotes/origin/master
 
+# Reset the jenkins worker's ruby environment back to
+# the state it was in when the instance was spun up.
+if [ -e $HOME/edx-rbenv_clean.tar.gz ]; then
+    rm -rf $HOME/.rbenv
+    tar -C $HOME -xf $HOME/edx-rbenv_clean.tar.gz
+fi
+
 # Bootstrap Ruby requirements so we can run the tests
 bundle install
 
diff --git a/jenkins/all-tests.sh b/jenkins/all-tests.sh
index 7d0bf8720c5..53adcc33b9c 100755
--- a/jenkins/all-tests.sh
+++ b/jenkins/all-tests.sh
@@ -59,6 +59,13 @@ mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSibli
 # not already be fetched.
 git fetch origin master:refs/remotes/origin/master
 
+# Reset the jenkins worker's ruby environment back to
+# the state it was in when the instance was spun up.
+if [ -e $HOME/edx-rbenv_clean.tar.gz ]; then
+    rm -rf $HOME/.rbenv
+    tar -C $HOME -xf $HOME/edx-rbenv_clean.tar.gz
+fi
+
 # Bootstrap Ruby requirements so we can run the tests
 bundle install
 
-- 
GitLab