Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 7b087b6

Browse files
c-knowlesmaxjacobson
authored andcommitted
Wire committed_at to ci_timestamp for codeship (#172)
* Wire committed_at to ci_timestamp for codeship For #156. Plus correct build identifier, `CI_BUILD_NUMBER` does not exist in codeship. * Fix some style issue
1 parent 1d92d9c commit 7b087b6

File tree

1 file changed

+15
-15
lines changed
  • lib/code_climate/test_reporter

1 file changed

+15
-15
lines changed

lib/code_climate/test_reporter/ci.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
module CodeClimate
22
module TestReporter
33
class Ci
4-
54
def self.service_data(env = ENV)
65
if env["TRAVIS"]
76
{
87
name: "travis-ci",
98
branch: env["TRAVIS_BRANCH"],
109
build_identifier: env["TRAVIS_JOB_ID"],
11-
pull_request: env["TRAVIS_PULL_REQUEST"]
10+
pull_request: env["TRAVIS_PULL_REQUEST"],
1211
}
1312
elsif env["CIRCLECI"]
1413
{
1514
name: "circleci",
1615
build_identifier: env["CIRCLE_BUILD_NUM"],
1716
branch: env["CIRCLE_BRANCH"],
18-
commit_sha: env["CIRCLE_SHA1"]
17+
commit_sha: env["CIRCLE_SHA1"],
1918
}
2019
elsif env["SEMAPHORE"]
2120
{
2221
name: "semaphore",
2322
branch: env["BRANCH_NAME"],
24-
build_identifier: env["SEMAPHORE_BUILD_NUMBER"]
23+
build_identifier: env["SEMAPHORE_BUILD_NUMBER"],
2524
}
2625
elsif env["JENKINS_URL"]
2726
{
2827
name: "jenkins",
2928
build_identifier: env["BUILD_NUMBER"],
3029
build_url: env["BUILD_URL"],
3130
branch: env["GIT_BRANCH"],
32-
commit_sha: env["GIT_COMMIT"]
31+
commit_sha: env["GIT_COMMIT"],
3332
}
3433
elsif env["TDDIUM"]
3534
{
3635
name: "tddium",
3736
build_identifier: env["TDDIUM_SESSION_ID"],
38-
worker_id: env["TDDIUM_TID"]
37+
worker_id: env["TDDIUM_TID"],
3938
}
4039
elsif env["WERCKER"]
4140
{
4241
name: "wercker",
4342
build_identifier: env["WERCKER_BUILD_ID"],
4443
build_url: env["WERCKER_BUILD_URL"],
4544
branch: env["WERCKER_GIT_BRANCH"],
46-
commit_sha: env["WERCKER_GIT_COMMIT"]
45+
commit_sha: env["WERCKER_GIT_COMMIT"],
4746
}
4847
elsif env["APPVEYOR"]
4948
{
@@ -52,7 +51,7 @@ def self.service_data(env = ENV)
5251
build_url: env["APPVEYOR_API_URL"],
5352
branch: env["APPVEYOR_REPO_BRANCH"],
5453
commit_sha: env["APPVEYOR_REPO_COMMIT"],
55-
pull_request: env["APPVEYOR_PULL_REQUEST_NUMBER"]
54+
pull_request: env["APPVEYOR_PULL_REQUEST_NUMBER"],
5655
}
5756
elsif env["CI_NAME"] =~ /DRONE/i
5857
{
@@ -61,16 +60,18 @@ def self.service_data(env = ENV)
6160
build_url: env["CI_BUILD_URL"],
6261
branch: env["CI_BRANCH"],
6362
commit_sha: env["CI_COMMIT"],
64-
pull_request: env["CI_PULL_REQUEST"]
63+
pull_request: env["CI_PULL_REQUEST"],
6564
}
6665
elsif env["CI_NAME"] =~ /codeship/i
6766
{
6867
name: "codeship",
69-
build_identifier: env["CI_BUILD_NUMBER"],
68+
build_identifier: env["CI_BUILD_ID"],
69+
# build URL cannot be reconstructed for Codeship since env does not contain project ID
7070
build_url: env["CI_BUILD_URL"],
7171
branch: env["CI_BRANCH"],
7272
commit_sha: env["CI_COMMIT_ID"],
73-
committed_at: env["CI_COMMITED_AT"],
73+
# CI timestamp is not quite equivalent to commited at but there's no equivalent in Codeship
74+
committed_at: env["CI_TIMESTAMP"],
7475
}
7576
elsif env["CI_NAME"] =~ /VEXOR/i
7677
{
@@ -79,28 +80,27 @@ def self.service_data(env = ENV)
7980
build_url: env["CI_BUILD_URL"],
8081
branch: env["CI_BRANCH"],
8182
commit_sha: env["CI_BUILD_SHA"],
82-
pull_request: env["CI_PULL_REQUEST_ID"]
83+
pull_request: env["CI_PULL_REQUEST_ID"],
8384
}
8485
elsif env["BUILDKITE"]
8586
{
8687
name: "buildkite",
8788
build_identifier: env["BUILDKITE_JOB_ID"],
8889
build_url: env["BUILDKITE_BUILD_URL"],
8990
branch: env["BUILDKITE_BRANCH"],
90-
commit_sha: env["BUILDKITE_COMMIT"]
91+
commit_sha: env["BUILDKITE_COMMIT"],
9192
}
9293
elsif env["GITLAB_CI"]
9394
{
9495
name: "gitlab-ci",
9596
build_identifier: env["CI_BUILD_ID"],
9697
branch: env["CI_BUILD_REF_NAME"],
97-
commit_sha: env["CI_BUILD_REF"]
98+
commit_sha: env["CI_BUILD_REF"],
9899
}
99100
else
100101
{}
101102
end
102103
end
103-
104104
end
105105
end
106106
end

0 commit comments

Comments
 (0)