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

Add support for self-hosted SCM #111

Merged
merged 11 commits into from
Nov 24, 2022
Merged

Add support for self-hosted SCM #111

merged 11 commits into from
Nov 24, 2022

Conversation

hunter
Copy link
Contributor

@hunter hunter commented Oct 31, 2022

Description

This PR adds support for optionally specifying a SCM to support self-hosted environments. The change defaults to github for backwards compatibility but should support Gitlab or GitHub self-hosted/enterprise deployments on a custom domain.

Before

chain-bench scan --repository-url <REPOSITORY_URL> --access-token <TOKEN> -o <OUTPUT_PATH>

After

chain-bench scan --repository-url <REPOSITORY_URL> --access-token <TOKEN> --scm-platform gitlab -o <OUTPUT_PATH>

Without SCM, chain-bench will fallback to Github SaaS - chain-bench scan --repository-url <REPOSITORY_URL> --access-token <TOKEN> -o <OUTPUT_PATH>

Currently only tested on Gitlab but opening the PR early for discussion. The PR also includes a small fix for Gitlab querying protected branches where repo names don't match the escaped path.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the readme with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Adds support for specifying an SCM for supporting self-hosted environments.
Matches the escaped name used in Github
@CLAassistant
Copy link

CLAassistant commented Oct 31, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@morwn morwn left a comment

Choose a reason for hiding this comment

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

Your contribution is very welcome, thanks!
I put some comments here, the main thing is to make this support an optional parameter, so it will not break the current behaviour

Co-authored-by: Mor Weinberger <morwnbrg@gmail.com>
Copy link
Contributor

@morwn morwn left a comment

Choose a reason for hiding this comment

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

Can you please adjust the test here to support your fix around the project name

@morwn morwn added the enhancement New feature or request label Nov 23, 2022
@morwn morwn merged commit ea7d32d into aquasecurity:main Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Self-hosted SCM support
4 participants