[Pkg-javascript-commits] [node-coveralls] 63/332: better jenkins support. better git object population.

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:53:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit ba65a7dd5e05e9ad97d36f2f893e8a8642aed517
Author: cainus <gregg at caines.ca>
Date:   Sat Jun 22 15:44:05 2013 -0700

    better jenkins support.  better git object population.
---
 lib/getOptions.js              | 42 +++++++++++++++++++++++++++++++++++-------
 package.json                   |  2 +-
 test/convertLcovToCoveralls.js |  3 ++-
 test/getOptions.js             | 28 +++++++++++++++++++++++++---
 4 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/lib/getOptions.js b/lib/getOptions.js
index 46957e5..d082d70 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -17,20 +17,48 @@ var getOptions = function(){
 		}
 	}
 
-  if (process.env.COVERALLS_GIT){
-    options.git = process.env.COVERALLS_GIT;
+
+  var git_commit = process.env.COVERALLS_GIT_COMMIT;
+  var git_branch = process.env.COVERALLS_GIT_BRANCH;
+
+  if (process.env.TRAVIS){
+    options.service_name = 'travis-ci';
+    options.service_job_id = process.env.TRAVIS_JOB_ID;
   }
-  if (process.env.COVERALLS_SERVICE_JOB_ID){
-    options.service_job_id = process.env.COVERALLS_SERVICE_JOB_ID;
+
+  if (process.env.JENKINS_URL){
+    options.service_name = 'jenkins';
+    options.service_job_id = process.env.BUILD_ID;
+    git_commit = process.env.GIT_COMMIT;
+    git_branch = process.env.GIT_BRANCH;
+  }
+
+  if (git_commit){
+    options.git = {
+      "head": {
+        "id": git_commit,
+        "author_name": "Unknown Author",
+        "author_email": "",
+        "committer_name": "Unknown Committer",
+        "committer_email": "",
+        "message": "Unknown Commit Message"
+      },
+      "branch": git_branch /*,
+      "remotes": [
+        {
+          "name": "origin",
+          "url": "git at github.com:lemurheavy/coveralls-ruby.git"
+        }
+      ]*/
+    };
   }
 
   options.run_at = process.env.COVERALLS_RUN_AT || JSON.stringify(new Date()).slice(1, -1);
   if (process.env.COVERALLS_SERVICE_NAME){
     options.service_name = process.env.COVERALLS_SERVICE_NAME;
   }
-  if (process.env.TRAVIS){
-    options.service_name = 'travis-ci';
-    options.service_job_id = process.env.TRAVIS_JOB_ID;
+  if (process.env.COVERALLS_SERVICE_JOB_ID){
+    options.service_job_id = process.env.COVERALLS_SERVICE_JOB_ID;
   }
 
 	// try to get the repo token as an environment variable
diff --git a/package.json b/package.json
index efe757b..d262d8b 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
     "coverage",
     "coveralls"
   ],
-  "version": "2.0.15",
+  "version": "2.0.16",
   "bugs": {
     "url": "https://github.com/cainus/node-coveralls/issues"
   },
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js
index aea36a1..eab2dd8 100644
--- a/test/convertLcovToCoveralls.js
+++ b/test/convertLcovToCoveralls.js
@@ -22,7 +22,8 @@ describe("convertLcovToCoveralls", function(){
 
   it ("should pass on all appropriate parameters from the environment", function(){
     process.env.TRAVIS_JOB_ID = -1;
-    process.env.COVERALLS_GIT = "GIT_HASH";
+    process.env.COVERALLS_GIT_COMMIT = "GIT_HASH";
+    process.env.COVERALLS_GIT_BRANCH = "master";
     process.env.COVERALLS_SERVICE_NAME = "SERVICE_NAME";
     process.env.COVERALLS_SERVICE_JOB_ID = "SERVICE_JOB_ID";
     process.env.COVERALLS_REPO_TOKEN = "REPO_TOKEN";
diff --git a/test/getOptions.js b/test/getOptions.js
index c1c2133..5c20c5c 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -19,9 +19,14 @@ describe("getOptions", function(){
     process.env.COVERALLS_SERVICE_JOB_ID = "SERVICE_JOB_ID";
     getOptions().service_job_id.should.equal("SERVICE_JOB_ID");
   });
-  it ("should set git if it exists", function(){
-    process.env.COVERALLS_GIT = "qwer";
-    getOptions().git.should.equal("qwer");
+  it ("should set git hash if it exists", function(){
+    process.env.COVERALLS_GIT_COMMIT = "e3e3e3e3e3e3e3e3e";
+    getOptions().git.head.id.should.equal("e3e3e3e3e3e3e3e3e");
+  });
+  it ("should set git hash if it exists", function(){
+    process.env.COVERALLS_GIT_COMMIT = "e3e3e3e3e3e3e3e3e";
+    process.env.COVERALLS_GIT_BRANCH = "master";
+    getOptions().git.branch.should.equal("master");
   });
   it ("should set repo_token if it exists", function(){
     process.env.COVERALLS_REPO_TOKEN = "REPO_TOKEN";
@@ -37,5 +42,22 @@ describe("getOptions", function(){
     getOptions().service_name.should.equal("travis-ci");
     getOptions().service_job_id.should.equal("1234");
   });
+  it ("should set service_name and service_job_id if it's running on jenkins", function(){
+    process.env.JENKINS_URL = "something";
+    process.env.BUILD_ID = "1234";
+    process.env.GIT_COMMIT = "a12s2d3df4f435g45g45g67h5g6";
+    process.env.GIT_BRANCH = "master";
+    var options = getOptions();
+    options.service_name.should.equal("jenkins");
+    options.service_job_id.should.equal("1234");
+    options.git.should.eql({ head:
+                               { id: 'a12s2d3df4f435g45g45g67h5g6',
+                                 author_name: 'Unknown Author',
+                                 author_email: '',
+                                 committer_name: 'Unknown Committer',
+                                 committer_email: '',
+                                 message: 'Unknown Commit Message' },
+                              branch: 'master' });
+  });
 
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list