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

Commit 6167aa8

Browse files
ChristianJacobseneddiemoore
authored andcommitted
Updates Semaphore CI Service for 2.0 (#132)
* Updates Semaphore CI Service for 2.0 Semaphore launched their 2.0 on November 6th 2018. The current Semaphore Service is using environment variables no longer present with Semaphore 2.0. I've purposefully removed the `build` and `slug` tags from the generated config as there is no good equivalent with Semaphore 2.0 anymore. List of 'git env vars' can be found at https://docs.semaphoreci.com/article/12-environment-variables * Adds the build tag back As requested, the `build` tag has been added back to the config and will now be read from the `SEMAPHORE_WORKFLOW_ID` as it's unique per 'run through the CI pipeline'.
1 parent e98d176 commit 6167aa8

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

lib/services/semaphore.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ module.exports = {
77
console.log(' Semaphore CI Detected')
88
return {
99
service: 'semaphore',
10-
build:
11-
process.env.SEMAPHORE_BUILD_NUMBER +
12-
'.' +
13-
process.env.SEMAPHORE_CURRENT_THREAD,
14-
commit: process.env.REVISION,
15-
branch: process.env.BRANCH_NAME,
16-
slug: process.env.SEMAPHORE_REPO_SLUG,
10+
branch: process.env.SEMAPHORE_GIT_BRANCH,
11+
build: process.env.SEMAPHORE_WORKFLOW_ID,
12+
commit: process.env.SEMAPHORE_GIT_SHA,
1713
}
1814
},
1915
}

test/services/semaphore.test.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ describe('Semaphore CI Provider', function() {
77
})
88

99
it('can get semaphore env info', function() {
10-
process.env.SEMAPHORE_BUILD_NUMBER = '1234'
11-
process.env.REVISION = '5678'
12-
process.env.SEMAPHORE_CURRENT_THREAD = '1'
13-
process.env.BRANCH_NAME = 'master'
14-
process.env.SEMAPHORE_REPO_SLUG = 'owner/repo'
10+
process.env.SEMAPHORE_GIT_BRANCH = 'development'
11+
process.env.SEMAPHORE_GIT_SHA = '5c84719708b9b649b9ef3b56af214f38cee6acde'
12+
process.env.SEMAPHORE_WORKFLOW_ID = '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf'
1513
expect(semaphore.configuration()).toEqual({
1614
service: 'semaphore',
17-
commit: '5678',
18-
build: '1234.1',
19-
branch: 'master',
20-
slug: 'owner/repo',
15+
branch: 'development',
16+
build: '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf',
17+
commit: '5c84719708b9b649b9ef3b56af214f38cee6acde',
2118
})
2219
})
2320
})

0 commit comments

Comments
 (0)