# GitLab

With our CI integration to GitLab you can automatically upload your latest commits and pull requests to Debricked or whenever you run your pipeline. Just like our other CI integrations it just takes a few minutes to set up!

# Integrating using an access token

  • Start by generating an access token by following the instructions here. Copy the token so that you can use it in the next step.
  • Configure your DEBRICKED_TOKEN by heading over to your repository -> Settings -> CI/CD and expand the "Variables" field, see below. Paste in the access token from the previous step. Environment variables anim

Tip

Make sure to mask the token, so that it does not show in the logs.

  • Go to your repository and add the following to your .gitlab-ci.yml file (if the file doesn't exist, create one):
# Vulnerability scanning
test:vulnerabilities:
    stage: test

    image:
        name: debricked/debricked-scan
        entrypoint: ["/gitlab-ci.sh"]

    script: echo "Done"

    variables:
	    DEBRICKED_TOKEN: $DEBRICKED_TOKEN
        # For all options, please check https://bitbucket.org/debricked/debricked-scan
  • Commit your changes to .gitlab-ci.yml and watch the CI run!

Tip

Our GitLab integration support the same options as our Bitbucket integration, read more about the options here https://bitbucket.org/debricked/debricked-scan

# Integrating with username and password

Note

We recommend using access tokens above to perform the integration. This is both more secure, and more reliable, since you can use different tokens for each integration, as well change your user password without affecting the integrations.

  • Configure your DEBRICKED_USERNAME (email) and DEBRICKED_PASSWORD variables by heading over to your repository -> Settings -> CI/CD and expand the "Variables" field, see below. Environment variables anim

Tip

Make sure to at least mask the password, so that it does not show in the logs.

  • Go to your repository and add the following to your .gitlab-ci.yml file (if the file doesn't exist, create one):
# Vulnerability scanning
test:vulnerabilities:
    stage: test

    image:
        name: debricked/debricked-scan
        entrypoint: ["/gitlab-ci.sh"]

    script: echo "Done"

    variables:
        USERNAME: $DEBRICKED_USERNAME # Your Debricked username
        PASSWORD: $DEBRICKED_PASSWORD # Your Debricked password
        # For all options, please check https://bitbucket.org/debricked/debricked-scan
  • Commit your changes to .gitlab-ci.yml and watch the CI run!

# Credentials for merge requests

Debricked can generate merge requests for you, but to be able to use it in Gitlab, you also need to provide us with credentials such that we can create the merge request on your Gitlab instance.

You can use either:

  • Personal access tokens
  • Project-scoped access tokens (currently available in paid versions of Gitlab), unique for every project

You can generate a Personal access token by going to the User settings. You need to grant the token the api scope, as in the picture below.

Personal access token

Then when you try to create a Merge Request inside the debricked tool, it will automatically ask you for your credentials when needed, as in the screenshot below.

Enter token

After clicking Confirm, the merge request generation should start.