Skip to content

Commit

Permalink
fix(gitlab): get build from CI_PIPELINE_ID and job from `CI_JOB…
Browse files Browse the repository at this point in the history
…_ID `
  • Loading branch information
abhisheksaxena7 authored and pvdlg committed Apr 22, 2018
1 parent d49dc22 commit b0a335c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = {
name: 'GitLab CI/CD',
service: 'gitlab',
commit: process.env.CI_COMMIT_SHA,
build: process.env.CI_JOB_NAME,
build: process.env.CI_PIPELINE_ID,
buildUrl: `${process.env.CI_PROJECT_URL}/pipelines/${process.env.CI_PIPELINE_ID}`,
job: process.env.CI_JOB_STAGE,
job: process.env.CI_JOB_ID,
jobUrl: `${process.env.CI_PROJECT_URL}/-/jobs/${process.env.CI_JOB_ID}`,
branch: process.env.CI_COMMIT_REF_NAME,
slug: process.env.CI_PROJECT_PATH,
Expand Down
6 changes: 2 additions & 4 deletions test/gitlab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import gitlab from '../lib/gitlab';
test('Push', t => {
process.env.GITLAB_CI = 'true';
process.env.CI_COMMIT_SHA = '5678';
process.env.CI_JOB_NAME = 'job_name';
process.env.CI_JOB_STAGE = '1234';
process.env.CI_PIPELINE_ID = '91011';
process.env.CI_JOB_ID = '1213';
process.env.CI_PROJECT_URL = 'https://gitlab.com/owner/repo';
Expand All @@ -17,11 +15,11 @@ test('Push', t => {
name: 'GitLab CI/CD',
service: 'gitlab',
commit: '5678',
build: 'job_name',
build: '91011',
buildUrl: 'https://gitlab.com/owner/repo/pipelines/91011',
branch: 'master',
root: '/',
job: '1234',
job: '1213',
jobUrl: 'https://gitlab.com/owner/repo/-/jobs/1213',
slug: 'owner/repo',
});
Expand Down

0 comments on commit b0a335c

Please sign in to comment.