From 79987567cade22cf3d3730ec844c8f180c9f6e5e Mon Sep 17 00:00:00 2001 From: Nikita Chuklinov Date: Thu, 18 Jul 2019 17:24:26 +0300 Subject: [PATCH 1/2] added ability to set custom SSL key and cert --- package.json | 1 + source/platforms/gitlab/GitLabAPI.ts | 4 ++ yarn.lock | 62 ++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/package.json b/package.json index 9a8fcf2dd..5231c70ad 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,7 @@ "@octokit/rest": "^16.14.1", "chalk": "^2.3.0", "commander": "^2.18.0", + "custom-node-gitlab-requester": "https://github.com/skyway777/custom-node-gitlab-requester", "debug": "^4.1.1", "get-stdin": "^6.0.0", "gitlab": "~6.0.0", diff --git a/source/platforms/gitlab/GitLabAPI.ts b/source/platforms/gitlab/GitLabAPI.ts index eaba34c58..4ebe7d016 100644 --- a/source/platforms/gitlab/GitLabAPI.ts +++ b/source/platforms/gitlab/GitLabAPI.ts @@ -12,6 +12,8 @@ import { } from "../../dsl/GitLabDSL" import { Gitlab } from "gitlab" +import { KyRequester } from "custom-node-gitlab-requester" + import { Env } from "../../ci_source/ci_source" import { debug } from "../../debug" @@ -20,6 +22,7 @@ export type GitLabAPIToken = string export interface GitLabAPICredentials { host: string token: GitLabAPIToken + requester: typeof KyRequester } export function getGitLabAPICredentialsFromEnv(env: Env): GitLabAPICredentials { @@ -35,6 +38,7 @@ export function getGitLabAPICredentialsFromEnv(env: Env): GitLabAPICredentials { return { host, token: env["DANGER_GITLAB_API_TOKEN"], + requester: KyRequester, } } diff --git a/yarn.lock b/yarn.lock index edf9ed3f7..d19cbba50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2876,6 +2876,18 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" +"custom-node-gitlab-requester@https://github.com/skyway777/custom-node-gitlab-requester": + version "1.0.0" + resolved "https://github.com/skyway777/custom-node-gitlab-requester#2f256e8a3cbf08c8f1dc0a678203e1d312f0a1ad" + dependencies: + form-data "^2.5.0" + fs "^0.0.1-security" + gitlab "^10.0.0" + https "^1.0.0" + humps "^2.0.1" + ky-universal "^0.2.2" + query-string "^6.8.1" + danger-plugin-jest@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/danger-plugin-jest/-/danger-plugin-jest-1.1.0.tgz#9b53e14a0483e6de5a65f8d58fbb6a8121a948d4" @@ -3828,6 +3840,15 @@ form-data@^2.3.3: combined-stream "^1.0.6" mime-types "^2.1.12" +form-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.0.tgz#094ec359dc4b55e7d62e0db4acd76e89fe874d37" + integrity sha512-WXieX3G/8side6VIqx44ablyULoGruSde5PNTxoUyo5CeyAMX6nVWUd0rgist/EuX655cjhUhTo1Fo3tRYqbcA== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + form-data@~2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" @@ -3916,6 +3937,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +fs@^0.0.1-security: + version "0.0.1-security" + resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4" + integrity sha1-invTcYa23d84E/I4WLV+yq9eQdQ= + fsevents@^1.2.2: version "1.2.4" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" @@ -4067,6 +4093,20 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" +gitlab@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/gitlab/-/gitlab-10.0.0.tgz#71dec3b79a7716263f7c63bb465b66e76da6348b" + integrity sha512-I8teXj+JzYokyPsoMWRbDKqesNafwRlOqrq7tuNIaeotvsVr+jb9WzEMen+Zy/dHLI6aHN/fp4N5pe3plrdJjQ== + dependencies: + form-data "^2.3.3" + humps "^2.0.1" + ky "^0.11.0" + ky-universal "^0.2.1" + li "^1.3.0" + query-string "^6.8.1" + randomstring "^1.1.5" + universal-url "^2.0.0" + gitlab@~6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gitlab/-/gitlab-6.0.0.tgz#7bd44bf57dcb6b1231c70a52ea9b83934e6c1539" @@ -4444,6 +4484,11 @@ https-proxy-agent@^2.2.0, https-proxy-agent@^2.2.1: agent-base "^4.1.0" debug "^3.1.0" +https@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/https/-/https-1.0.0.tgz#3c37c7ae1a8eeb966904a2ad1e975a194b7ed3a4" + integrity sha1-PDfHrhqO65ZpBKKtHpdaGUt+06Q= + humps@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/humps/-/humps-2.0.1.tgz#dd02ea6081bd0568dc5d073184463957ba9ef9aa" @@ -5653,6 +5698,14 @@ ky-universal@^0.2.1: abort-controller "^3.0.0" node-fetch "^2.3.0" +ky-universal@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/ky-universal/-/ky-universal-0.2.2.tgz#7a36e1a75641a98f878157463513965f799f5bfe" + integrity sha512-fb32o/fKy/ux2ALWa9HU2hvGtfOq7/vn2nH0FpVE+jwNzyTeORlAbj3Fiw+WLMbUlmVqZIWupnLZ2USHvqwZHw== + dependencies: + abort-controller "^3.0.0" + node-fetch "^2.3.0" + ky@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/ky/-/ky-0.11.0.tgz#032e01e10979f9f16682f6acff7daf43cafa5507" @@ -7429,6 +7482,15 @@ query-string@^6.5.0: split-on-first "^1.0.0" strict-uri-encode "^2.0.0" +query-string@^6.8.1: + version "6.8.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.8.1.tgz#62c54a7ef37d01b538c8fd56f95740c81d438a26" + integrity sha512-g6y0Lbq10a5pPQpjlFuojfMfV1Pd2Jw9h75ypiYPPia3Gcq2rgkKiIwbkS6JxH7c5f5u/B/sB+d13PU+g1eu4Q== + dependencies: + decode-uri-component "^0.2.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" From 018b8a3c28ad6e2eb20e87edb15ebf4abd476257 Mon Sep 17 00:00:00 2001 From: Nikita Chuklinov Date: Thu, 18 Jul 2019 18:34:27 +0300 Subject: [PATCH 2/2] added docs --- CHANGELOG.md | 1 + docs/guides/faq.html.md | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eea5f281..e4c50893a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ +- Added [two-way authentication](https://en.wikipedia.org/wiki/Mutual_authentication) support for gitlab - [@skyway777] - Improve Performance by Caching BitBucket Cloud Commits - [@hellocore] - Add compliment message to comment template on Bitbucket Cloud - [@hellocore] diff --git a/docs/guides/faq.html.md b/docs/guides/faq.html.md index 6cc0e393f..3da86f825 100644 --- a/docs/guides/faq.html.md +++ b/docs/guides/faq.html.md @@ -46,6 +46,16 @@ DEBUG="*" yarn danger ci This will print out a _lot_ of information. +## I'm using two-way authentication in my Gitlab + +You can use env-variables for working with certificates in Gitlab. E.g: + +```sh +GITLAB_SSL_KEY=/path/to/my/key GITLAB_SSL_CERT=/path/to/mycert NODE_EXTRA_CA_CERTS=/path/to/my/ca/certs yarn danger pr https://my-gitlab/my-project/mr/453 +``` + +Also you can set env variables in your Gitlab GUI + ## Circle CI doesnt run my build consistently Yeah... We're struggling with that one. It's something we keep taking stabs at improving, so [keep an eye on the