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

Commit e427d90

Browse files
ikatyangeddiemoore
authored andcommittedDec 12, 2018
feat(services): add azure pipelines (#114)
1 parent 023d204 commit e427d90

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
 

‎lib/detect.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var services = {
22
travis: require('./services/travis'),
33
circle: require('./services/circle'),
44
buildkite: require('./services/buildkite'),
5+
azurePipelines: require('./services/azurePipelines'),
56
codeship: require('./services/codeship'),
67
drone: require('./services/drone'),
78
appveyor: require('./services/appveyor'),

‎lib/services/azurePipelines.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
detect: function() {
3+
return !!process.env.TF_BUILD
4+
},
5+
6+
configuration: function() {
7+
console.log(' Azure Pipelines CI Detected')
8+
return {
9+
service: 'azure_pipelines',
10+
commit: process.env.BUILD_SOURCEVERSION,
11+
branch: process.env.BUILD_SOURCEBRANCH,
12+
pr: process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER,
13+
job: process.env.SYSTEM_JOBID,
14+
build: process.env.BUILD_BUILDID,
15+
build_url:
16+
process.env.SYSTEM_TEAMFOUNDATIONSERVERURI +
17+
process.env.SYSTEM_TEAMPROJECT +
18+
'/_build/results?buildId=' +
19+
process.env.BUILD_BUILDID,
20+
slug: process.env.BUILD_REPOSITORY_ID,
21+
}
22+
},
23+
}

‎test/services/azure-pipelines.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var azurePipelines = require('../../lib/services/azurePipelines')
2+
3+
describe('Azure Pipelines CI Provider', function() {
4+
it('can detect azure pipelines', function() {
5+
process.env.TF_BUILD = '1'
6+
expect(azurePipelines.detect()).to.be(true)
7+
})
8+
9+
it('can get azure pipelines env info', function() {
10+
process.env.BUILD_SOURCEBRANCH = 'master'
11+
process.env.SYSTEM_JOBID = '92a2fa25-f940-5df6-a185-81eb9ae2031d'
12+
process.env.BUILD_BUILDID = '1'
13+
process.env.SYSTEM_TEAMFOUNDATIONSERVERURI =
14+
'https://dev.azure.com/codecov/'
15+
process.env.SYSTEM_TEAMPROJECT = 'repo'
16+
process.env.BUILD_SOURCEVERSION = '743b04806ea677403aa2ff26c6bdeb85005de658'
17+
process.env.BUILD_REPOSITORY_ID = 'owner/repo'
18+
process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER = '1234'
19+
20+
expect(azurePipelines.configuration()).to.eql({
21+
service: 'azure_pipelines',
22+
build: '1',
23+
build_url: 'https://dev.azure.com/codecov/repo/_build/results?buildId=1',
24+
job: '92a2fa25-f940-5df6-a185-81eb9ae2031d',
25+
commit: '743b04806ea677403aa2ff26c6bdeb85005de658',
26+
pr: '1234',
27+
branch: 'master',
28+
slug: 'owner/repo',
29+
})
30+
})
31+
})

0 commit comments

Comments
 (0)
This repository has been archived.