Skip to content

Commit

Permalink
Merge pull request #131 from mrcrgl/feature/support-codeship-docker-e…
Browse files Browse the repository at this point in the history
…nvironment

Feature: Support codeship docker environment variables
  • Loading branch information
nickmerwin authored Sep 15, 2016
2 parents 95c4dfd + 2fb137e commit 272e662
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/getOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var getBaseOptions = function(cb){
var options = {};
var git_commit = process.env.COVERALLS_GIT_COMMIT;
var git_branch = process.env.COVERALLS_GIT_BRANCH;
var git_committer_name, git_committer_email, git_message;

var match = (process.env.CI_PULL_REQUEST || "").match(/(\d+)$/);

Expand Down Expand Up @@ -57,6 +58,9 @@ var getBaseOptions = function(cb){
options.service_job_id = process.env.CI_BUILD_NUMBER;
git_commit = process.env.CI_COMMIT_ID;
git_branch = process.env.CI_BRANCH;
git_committer_name = process.env.CI_COMMITTER_NAME;
git_committer_email = process.env.CI_COMMITTER_EMAIL;
git_message = process.env.CI_COMMIT_MESSAGE;
}

if (process.env.WERCKER){
Expand Down Expand Up @@ -123,7 +127,10 @@ var getBaseOptions = function(cb){
if (git_commit){
fetchGitData({
head: {
id: git_commit
id: git_commit,
committer_name: git_committer_name,
committer_email: git_committer_email,
message: git_message
},
branch: git_branch
}, function(err, git){
Expand Down
9 changes: 6 additions & 3 deletions test/getOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,19 @@ var testCodeship = function(sut, done) {
process.env.CI_BUILD_NUMBER = '1234';
process.env.CI_COMMIT_ID = "e3e3e3e3e3e3e3e3e";
process.env.CI_BRANCH = "master";
process.env.CI_COMMITTER_NAME = "John Doe";
process.env.CI_COMMITTER_EMAIL = "jd@example.com";
process.env.CI_COMMIT_MESSAGE = "adadadadadadadadadad";
sut(function(err, options){
options.service_name.should.equal("codeship");
options.service_job_id.should.equal("1234");
options.git.should.eql({ head:
{ id: 'e3e3e3e3e3e3e3e3e',
author_name: 'Unknown Author',
author_email: '',
committer_name: 'Unknown Committer',
committer_email: '',
message: 'Unknown Commit Message' },
committer_name: 'John Doe',
committer_email: 'jd@example.com',
message: 'adadadadadadadadadad' },
branch: 'master',
remotes: [] });
done();
Expand Down

0 comments on commit 272e662

Please sign in to comment.