From d4cdd5b4855f8469253d1616f7290862aceaba4d Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 09:38:47 -0500 Subject: [PATCH 1/8] Make jenkins talk to the github status api --- jenkins/base.sh | 12 ++++++++++++ jenkins/test_edge.sh | 7 ++++++- jenkins/test_lms.sh | 10 +++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 jenkins/base.sh diff --git a/jenkins/base.sh b/jenkins/base.sh new file mode 100644 index 0000000000..c7175e6e52 --- /dev/null +++ b/jenkins/base.sh @@ -0,0 +1,12 @@ + +function github_status { + gcli status create mitx mitx $GIT_COMMIT \ + --params=$1 \ + target_url:$BUILD_URL \ + description:"Build #$BUILD_NUMBER is running" \ + -f csv +} + +function github_mark_failed_on_exit { + trap '[ $? == "0" ] || github_status state:failed' EXIT +} \ No newline at end of file diff --git a/jenkins/test_edge.sh b/jenkins/test_edge.sh index ccca91fc37..71405d663f 100755 --- a/jenkins/test_edge.sh +++ b/jenkins/test_edge.sh @@ -3,6 +3,9 @@ set -e set -x +github_mark_failed_on_exit +github_status state:pending + # Reset the submodule, in case it changed git submodule foreach 'git reset --hard HEAD' @@ -26,4 +29,6 @@ rake phantomjs_jasmine_cms || true rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] -rake autodeploy_properties \ No newline at end of file +rake autodeploy_properties + +github_status state:success diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh index a7f8555f81..69fbf50dfa 100755 --- a/jenkins/test_lms.sh +++ b/jenkins/test_lms.sh @@ -3,6 +3,12 @@ set -e set -x +. base.sh + +github_mark_failed_on_exit +github_status state:pending + + # Reset the submodule, in case it changed git submodule foreach 'git reset --hard HEAD' @@ -24,4 +30,6 @@ rake phantomjs_jasmine_lms || true rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] -rake autodeploy_properties \ No newline at end of file +rake autodeploy_properties + +github_status state:success From 724cba193af06d3aa890dc602a3e56d55713491c Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 09:43:52 -0500 Subject: [PATCH 2/8] Source the base jenkins configuration before running tests --- jenkins/test_edge.sh | 2 ++ jenkins/test_lms.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jenkins/test_edge.sh b/jenkins/test_edge.sh index 71405d663f..51d24bc6f6 100755 --- a/jenkins/test_edge.sh +++ b/jenkins/test_edge.sh @@ -3,6 +3,8 @@ set -e set -x +source base.sh + github_mark_failed_on_exit github_status state:pending diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh index 69fbf50dfa..13d7ffb885 100755 --- a/jenkins/test_lms.sh +++ b/jenkins/test_lms.sh @@ -3,7 +3,7 @@ set -e set -x -. base.sh +source base.sh github_mark_failed_on_exit github_status state:pending From 86579efc5bce7799089dcb64b1bb9731a3cad12c Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 09:59:21 -0500 Subject: [PATCH 3/8] Source jenkins/base.sh with the correct path --- jenkins/base.sh | 1 + jenkins/test_edge.sh | 2 +- jenkins/test_lms.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jenkins/base.sh b/jenkins/base.sh index c7175e6e52..1b28028541 100644 --- a/jenkins/base.sh +++ b/jenkins/base.sh @@ -1,3 +1,4 @@ +#! /bin/bash function github_status { gcli status create mitx mitx $GIT_COMMIT \ diff --git a/jenkins/test_edge.sh b/jenkins/test_edge.sh index 51d24bc6f6..cb6678c04c 100755 --- a/jenkins/test_edge.sh +++ b/jenkins/test_edge.sh @@ -3,7 +3,7 @@ set -e set -x -source base.sh +source jenkins/base.sh github_mark_failed_on_exit github_status state:pending diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh index 13d7ffb885..257609e80d 100755 --- a/jenkins/test_lms.sh +++ b/jenkins/test_lms.sh @@ -3,7 +3,7 @@ set -e set -x -source base.sh +source jenkins/base.sh github_mark_failed_on_exit github_status state:pending From 3f5187401d9e2d48b2177d7672c0c313a979815b Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 10:29:13 -0500 Subject: [PATCH 4/8] Change message with state --- jenkins/base.sh | 4 ++-- jenkins/test_edge.sh | 4 ++-- jenkins/test_lms.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jenkins/base.sh b/jenkins/base.sh index 1b28028541..d5782fa732 100644 --- a/jenkins/base.sh +++ b/jenkins/base.sh @@ -4,10 +4,10 @@ function github_status { gcli status create mitx mitx $GIT_COMMIT \ --params=$1 \ target_url:$BUILD_URL \ - description:"Build #$BUILD_NUMBER is running" \ + description:"Build #$BUILD_NUMBER $2" \ -f csv } function github_mark_failed_on_exit { - trap '[ $? == "0" ] || github_status state:failed' EXIT + trap '[ $? == "0" ] || github_status state:failed "failed"' EXIT } \ No newline at end of file diff --git a/jenkins/test_edge.sh b/jenkins/test_edge.sh index cb6678c04c..19ff5ecbde 100755 --- a/jenkins/test_edge.sh +++ b/jenkins/test_edge.sh @@ -6,7 +6,7 @@ set -x source jenkins/base.sh github_mark_failed_on_exit -github_status state:pending +github_status state:pending "is running" # Reset the submodule, in case it changed git submodule foreach 'git reset --hard HEAD' @@ -33,4 +33,4 @@ rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] rake autodeploy_properties -github_status state:success +github_status state:success "passed" diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh index 257609e80d..9410845cdb 100755 --- a/jenkins/test_lms.sh +++ b/jenkins/test_lms.sh @@ -6,7 +6,7 @@ set -x source jenkins/base.sh github_mark_failed_on_exit -github_status state:pending +github_status state:pending "is running" # Reset the submodule, in case it changed @@ -32,4 +32,4 @@ rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] rake autodeploy_properties -github_status state:success +github_status state:success "passed" From d4ec5946d48c6d4f732d59b747fb1e88a4812fc4 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 10:37:44 -0500 Subject: [PATCH 5/8] Mark failed state correctly --- jenkins/base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/base.sh b/jenkins/base.sh index d5782fa732..274c8d3027 100644 --- a/jenkins/base.sh +++ b/jenkins/base.sh @@ -9,5 +9,5 @@ function github_status { } function github_mark_failed_on_exit { - trap '[ $? == "0" ] || github_status state:failed "failed"' EXIT + trap '[ $? == "0" ] || github_status state:failure "failed"' EXIT } \ No newline at end of file From 5a3cdc11cd2aaf7bb2602b260fac6168e06f9534 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 10:41:24 -0500 Subject: [PATCH 6/8] Only mark github commit status when full test suite passes --- jenkins/test_lms.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh index 9410845cdb..5a2f2a0924 100755 --- a/jenkins/test_lms.sh +++ b/jenkins/test_lms.sh @@ -3,12 +3,6 @@ set -e set -x -source jenkins/base.sh - -github_mark_failed_on_exit -github_status state:pending "is running" - - # Reset the submodule, in case it changed git submodule foreach 'git reset --hard HEAD' @@ -31,5 +25,3 @@ rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] rake autodeploy_properties - -github_status state:success "passed" From e2ed7d1c4e87a3af09099a31785532a56055e695 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 10:56:24 -0500 Subject: [PATCH 7/8] Move to a single test.sh file that only runs the relevant tests for a particular branch in the repo. In particular, don't run cms tests on branches derived from master --- jenkins/{test_edge.sh => test.sh} | 6 ++++-- jenkins/test_lms.sh | 27 --------------------------- 2 files changed, 4 insertions(+), 29 deletions(-) rename jenkins/{test_edge.sh => test.sh} (77%) delete mode 100755 jenkins/test_lms.sh diff --git a/jenkins/test_edge.sh b/jenkins/test.sh similarity index 77% rename from jenkins/test_edge.sh rename to jenkins/test.sh index 19ff5ecbde..ed65fd2618 100755 --- a/jenkins/test_edge.sh +++ b/jenkins/test.sh @@ -22,12 +22,14 @@ yes w | pip install -q -r requirements.txt rake clobber TESTS_FAILED=0 -rake test_cms[false] || TESTS_FAILED=1 +# Don't run the studio tests until feature/cale/cms-master is merged in +# rake test_cms[false] || TESTS_FAILED=1 rake test_lms[false] || TESTS_FAILED=1 rake test_common/lib/capa || TESTS_FAILED=1 rake test_common/lib/xmodule || TESTS_FAILED=1 rake phantomjs_jasmine_lms || true -rake phantomjs_jasmine_cms || true +# Don't run the studio tests until feature/cale/cms-master is merged in +# rake phantomjs_jasmine_cms || true rake coverage:xml coverage:html [ $TESTS_FAILED == '0' ] diff --git a/jenkins/test_lms.sh b/jenkins/test_lms.sh deleted file mode 100755 index 5a2f2a0924..0000000000 --- a/jenkins/test_lms.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/bash - -set -e -set -x - -# Reset the submodule, in case it changed -git submodule foreach 'git reset --hard HEAD' - -# Set the IO encoding to UTF-8 so that askbot will start -export PYTHONIOENCODING=UTF-8 - -GIT_BRANCH=${GIT_BRANCH/HEAD/master} - -pip install -q -r pre-requirements.txt -pip install -q -r test-requirements.txt -yes w | pip install -q -r requirements.txt - -rake clobber -TESTS_FAILED=0 -rake test_lms[false] || TESTS_FAILED=1 -rake test_common/lib/capa || TESTS_FAILED=1 -rake test_common/lib/xmodule || TESTS_FAILED=1 -rake phantomjs_jasmine_lms || true -rake coverage:xml coverage:html - -[ $TESTS_FAILED == '0' ] -rake autodeploy_properties From 38671fc83c3d00f8908cd6aa9e4e2a0e377880bf Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 11:01:58 -0500 Subject: [PATCH 8/8] Move files from base.sh to test.sh --- jenkins/base.sh | 13 ------------- jenkins/test.sh | 12 +++++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) delete mode 100644 jenkins/base.sh diff --git a/jenkins/base.sh b/jenkins/base.sh deleted file mode 100644 index 274c8d3027..0000000000 --- a/jenkins/base.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/bash - -function github_status { - gcli status create mitx mitx $GIT_COMMIT \ - --params=$1 \ - target_url:$BUILD_URL \ - description:"Build #$BUILD_NUMBER $2" \ - -f csv -} - -function github_mark_failed_on_exit { - trap '[ $? == "0" ] || github_status state:failure "failed"' EXIT -} \ No newline at end of file diff --git a/jenkins/test.sh b/jenkins/test.sh index ed65fd2618..8a96024785 100755 --- a/jenkins/test.sh +++ b/jenkins/test.sh @@ -3,7 +3,17 @@ set -e set -x -source jenkins/base.sh +function github_status { + gcli status create mitx mitx $GIT_COMMIT \ + --params=$1 \ + target_url:$BUILD_URL \ + description:"Build #$BUILD_NUMBER $2" \ + -f csv +} + +function github_mark_failed_on_exit { + trap '[ $? == "0" ] || github_status state:failure "failed"' EXIT +} github_mark_failed_on_exit github_status state:pending "is running"