Skip to content
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

Working with two-way authentication in custom Gitlab server #895

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

skyway777
Copy link

Before this PR, DangerJS was supporting only NODE_EXTRA_CA_CERTS env-variable to set CA certificates.

In my case, I need to use also my SSL Key and my SSL Certificate to connect to Gitlab Api.

When reading node-gitlab docs https://github.com/jdalrymple/node-gitlab I've found only way to do this as using custom requester (requester prop in options)

So, I've made my own KyRequestor realization with supporting of GITLAB_SSL_KEY and GITLAB_SSL_CERT env-variables.

@skyway777
Copy link
Author

Maybe there is better way to do it?

li "^1.3.0"
query-string "^6.8.1"
randomstring "^1.1.5"
universal-url "^2.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried that we have both gitlab 10, as we have gitlab locked to v6 in the app - have you tried updating gitlab to v10 and seeing if that can fix it in general?

Copy link
Author

@skyway777 skyway777 Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I've tried to use just node script without dangerjs with last gitlab as dependency.
This problem was reproduced.

Gitlab have an option to fix it - not very handy but working - send custom requester as parameter.
I made the fix with extra options
actually, this function in my code fixes my problem:

function buildAgent() {
    const { GITLAB_SSL_KEY, GITLAB_SSL_CERT } = process.env;

    if (GITLAB_SSL_KEY || GITLAB_SSL_CERT) {
        const key = readKey(GITLAB_SSL_KEY);
        const cert = readKey(GITLAB_SSL_CERT);

        return new https.Agent({
            key,
            cert,
        })
    }
    return;
}

If it would be better for this PR, I can downgrade some dependencies in my project.

Or, maybe, would be better to extend Dangerjs API to allow sending extra platform-specific options (github, bitbucket etc.) in dangerfile script? Like requester in gitlab https://github.com/jdalrymple/node-gitlab
It would allows me do not fork danger-js only to use it in my case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth giving this another shot now that #903 is in

This comment was marked as spam.

@DangerCI
Copy link

Warnings
⚠️ Could not get info from npm on custom-node-gitlab-requester

New dependencies added: custom-node-gitlab-requester.

Generated by 🚫 dangerJS against 5a1a73d

@ludakhris
Copy link

I'm curious whats up with this PR, I'm having a similar issue it seems like with a gitlab self hosted instance that has two way auth.

@skyway777
Copy link
Author

@ludakhris I cannot check if it does work now, since I don't have access to the GitLab instance for which I've created this PR anymore. But if you need this, you can build my fork of DangerJS. It depends on my custom custom-node-gitlab-requester, which also required building.

Base automatically changed from master to main February 4, 2021 08:31
@Jimimaku

This comment was marked as spam.

@Jimimaku

This comment was marked as spam.

@Jimimaku

This comment was marked as spam.

@Jimimaku

This comment was marked as spam.

@fbartho

This comment was marked as off-topic.

@glensc

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants