-
-
Notifications
You must be signed in to change notification settings - Fork 374
Adds support for GitLab CI #855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
9c8ba47
Recognise DANGER_GITLAB_HOST env
notjosh cc632c2
GitLab implementation & tests for pullRequestParser
notjosh e6410b8
Added base platform code for GitLab
notjosh 91ef63a
Fetchin' live MR vales from GitLab API
notjosh c274eb8
Oof, there's a lot going on in there. The runner works in another pro…
notjosh 8ef0581
Generally the pulling/reading works, to the point of commenting
notjosh abecf38
The nuts & bolts of API commenting are working
notjosh 8ceb1ec
Inline comments seem to sort of work?
notjosh 2367ed3
Minor bugfix to only delete comments that Danger created
notjosh a22c68b
Support GitLab CI as a CI source
bigkraig 76b7bb1
Fixes inline commenting in GitLab
bigkraig 957412c
Added CHANGELOG entry
bigkraig d344384
Added GitLab to README
bigkraig 527c62c
Merge branch 'master' into feature/gitlab
bigkraig b2ec339
Removed unused test file
bigkraig 5168c45
Throwing errors on not yet implemented gitlab functions
bigkraig 7d9b5c9
Using the CI_MERGE_REQUEST_IID var according to https://docs.gitlab.c…
bigkraig f0d1e81
Removed some accidentally added vscode configuration
bigkraig 6ac429c
Updated the gitlab dependency to include support for Node 8
bigkraig 4acda3b
Bumped the oldest node to something not so old (8.9)
bigkraig 06ea6d9
Merge branch 'master' into feature/gitlab
bigkraig 7d629cc
Changed out the older node 8 tests to test against the current LTS ve…
bigkraig 19a35b7
Merge remote-tracking branch 'upstream/master' into feature/gitlab
e3a78d7
Add tests for GitLab
2d3c6de
Merge pull request #1 from jamime/feature/gitlab
bigkraig ab83665
delete main comment when all issues are resolved
a26047e
Merge pull request #2 from bigkraig/feature/delete_comment
jamime 7b34217
update gitlab dep
2ba17eb
use GITLAB_CI to detect CI
765d5d6
Revert "update gitlab dep"
3a337fb
improve GitLab environment detection
157383b
fix: use DANGER_GITLAB_API_TOKEN to detect DSL type
657e0a0
Merge branch 'master' into feature/gitlab
f-meloni 9bf4690
fix: updateOrCreateComment note detection
9363aa1
update gitlab dep
1d75688
docs: update command in readme
0952bac
chore: tidy code
67662eb
fix: improve danger-pr
78af7b2
feat: GitLab fileContents
8776aa6
fix: change GitHub platform to be a named function instead of an arro…
083cff7
ci: trigger build
b386dae
feat: add logging to GitLabAPI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import { Env, CISource } from "../ci_source" | ||
| import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "../ci_source_helpers" | ||
|
|
||
| export class GitLabCI implements CISource { | ||
| constructor(private readonly env: Env) {} | ||
|
|
||
| get name(): string { | ||
| return "GitLab CI" | ||
| } | ||
|
|
||
| get isCI(): boolean { | ||
| return ensureEnvKeysExist(this.env, ["CI_MR_ID"]) | ||
| } | ||
|
|
||
| get isPR(): boolean { | ||
| const mustHave = ["CI_MR_ID", "CI_PROJECT_PATH"] | ||
| const mustBeInts = ["CI_MR_ID"] | ||
| return ensureEnvKeysExist(this.env, mustHave) && ensureEnvKeysAreInt(this.env, mustBeInts) | ||
| } | ||
|
|
||
| get pullRequestID(): string { | ||
| return this.env.CI_MR_ID | ||
| } | ||
|
|
||
| get repoSlug(): string { | ||
| return this.env.CI_PROJECT_PATH | ||
| } | ||
| } | ||
|
|
||
| // See https://docs.gitlab.com/ee/ci/variables/ | ||
| // | ||
| // export CI_JOB_ID="50" | ||
| // export CI_COMMIT_SHA="1ecfd275763eff1d6b4844ea3168962458c9f27a" | ||
| // export CI_COMMIT_SHORT_SHA="1ecfd275" | ||
| // export CI_COMMIT_REF_NAME="master" | ||
| // export CI_REPOSITORY_URL="https://gitlab-ci-token:[email protected]/gitlab-org/gitlab-ce.git" | ||
| // export CI_COMMIT_TAG="1.0.0" | ||
| // export CI_JOB_NAME="spec:other" | ||
| // export CI_JOB_STAGE="test" | ||
| // export CI_JOB_MANUAL="true" | ||
| // export CI_JOB_TRIGGERED="true" | ||
| // export CI_JOB_TOKEN="abcde-1234ABCD5678ef" | ||
| // export CI_PIPELINE_ID="1000" | ||
| // export CI_PIPELINE_IID="10" | ||
| // export CI_PAGES_DOMAIN="gitlab.io" | ||
| // export CI_PAGES_URL="https://gitlab-org.gitlab.io/gitlab-ce" | ||
| // export CI_PROJECT_ID="34" | ||
| // export CI_PROJECT_DIR="/builds/gitlab-org/gitlab-ce" | ||
| // export CI_PROJECT_NAME="gitlab-ce" | ||
| // export CI_PROJECT_NAMESPACE="gitlab-org" | ||
| // export CI_PROJECT_PATH="gitlab-org/gitlab-ce" | ||
| // export CI_PROJECT_URL="https://example.com/gitlab-org/gitlab-ce" | ||
| // export CI_REGISTRY="registry.example.com" | ||
| // export CI_REGISTRY_IMAGE="registry.example.com/gitlab-org/gitlab-ce" | ||
| // export CI_RUNNER_ID="10" | ||
| // export CI_RUNNER_DESCRIPTION="my runner" | ||
| // export CI_RUNNER_TAGS="docker, linux" | ||
| // export CI_SERVER="yes" | ||
| // export CI_SERVER_NAME="GitLab" | ||
| // export CI_SERVER_REVISION="70606bf" | ||
| // export CI_SERVER_VERSION="8.9.0" | ||
| // export CI_SERVER_VERSION_MAJOR="8" | ||
| // export CI_SERVER_VERSION_MINOR="9" | ||
| // export CI_SERVER_VERSION_PATCH="0" | ||
| // export GITLAB_USER_ID="42" | ||
| // export GITLAB_USER_EMAIL="[email protected]" | ||
| // export CI_REGISTRY_USER="gitlab-ci-token" | ||
| // export CI_REGISTRY_PASSWORD="longalfanumstring" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.