Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Add support for Jenkins Blue Ocean #94

Merged
merged 1 commit into from
Apr 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.egg
*.egg-info
*.pyc
.cache
.coverage
.DS_Store
.tox
Expand Down
4 changes: 2 additions & 2 deletions codecov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ def main(*argv, **kwargs):
if os.getenv('JENKINS_URL'):
# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project
# https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables
query.update(dict(branch=os.getenv('ghprbSourceBranch') or os.getenv('GIT_BRANCH'),
query.update(dict(branch=os.getenv('ghprbSourceBranch') or os.getenv('GIT_BRANCH') or os.getenv('BRANCH_NAME'),
service='jenkins',
commit=os.getenv('ghprbActualCommit') or os.getenv('GIT_COMMIT'),
pr=os.getenv('ghprbPullId', 'false'),
pr=os.getenv('ghprbPullId') or os.getenv('CHANGE_ID'),
build=os.getenv('BUILD_NUMBER'),
build_url=os.getenv('BUILD_URL')))
root = os.getenv('WORKSPACE') or root
Expand Down
19 changes: 18 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setUp(self):
"APPVEYOR_BUILD_VERSION", "APPVEYOR_JOB_ID", "APPVEYOR_REPO_NAME", "APPVEYOR_REPO_COMMIT", "WERCKER_GIT_BRANCH",
"WERCKER_MAIN_PIPELINE_STARTED", "WERCKER_GIT_OWNER", "WERCKER_GIT_REPOSITORY",
"CI_BUILD_REF_NAME", "CI_BUILD_ID", "CI_BUILD_REPO", "CI_PROJECT_DIR", "CI_BUILD_REF", "CI_SERVER_NAME",
"ghprbActualCommit", "ghprbSourceBranch", "ghprbPullId", "WERCKER_GIT_COMMIT"):
"ghprbActualCommit", "ghprbSourceBranch", "ghprbPullId", "WERCKER_GIT_COMMIT", "CHANGE_ID"):
os.environ[key] = ""

def tearDown(self):
Expand Down Expand Up @@ -339,6 +339,23 @@ def test_ci_jenkins_env(self):
self.assertEqual(res['query']['branch'], 'master')
self.assertEqual(res['codecov'].token, 'token')

def test_ci_jenkins_blue_ocean(self):
self.set_env(JENKINS_URL='https://....',
BUILD_URL='https://....',
BRANCH_NAME='master',
CHANGE_ID='1',
BUILD_NUMBER='41',
CODECOV_TOKEN='token')
self.fake_report()
res = self.run_cli()
self.assertEqual(res['query']['service'], 'jenkins')
self.assertEqual(res['query']['commit'], codecov.check_output(("git", "rev-parse", "HEAD")))
self.assertEqual(res['query']['build'], '41')
self.assertEqual(res['query']['build_url'], 'https://....')
self.assertEqual(res['query']['pr'], '1')
self.assertEqual(res['query']['branch'], 'master')
self.assertEqual(res['codecov'].token, 'token')

def test_ci_travis(self):
self.set_env(TRAVIS="true",
TRAVIS_BRANCH="master",
Expand Down