Run Spectral on every commit and get context-aware results directly in your pipeline
10K+
Spectral helps you monitor, classify and protect your code, assets and infrastructure for exposed API keys, tokens, credentials and high-risk security misconfigurations in a simple way, without noise.
This image helps you run Spectral inside your CI/CD process in GitLab. In order to run this image you should make sure you have the required GitLab infrastructure such as a GitLab runner based on docker executor.
Gitlab pipeline scanner brings optimal developer experience by focusing on the actual problems in your change set.
There are two running run modes possible for the job:
To run the image properly you'll need to apply those environment variables on your project (or higher level GitLab component) settings:
| Name | Required | Description |
|---|---|---|
| GITLAB_TOKEN | Yes | Generate it in your Gitlab profile -> Access Tokens, check the "api" scope (leave blank if you are using vault) |
| SELF_HOSTED_GITLAB_DOMAIN | Yes | if you're running a self-hosted Gitlab provide the domain here. eg. https://my-gitlab-domain.com |
| SPECTRAL_DSN | Yes | Your Spectral DSN retrieved from SpectralOps (leave blank if you are using vault) |
| SPECTRAL_TAGS | No | Tags list to run Spectral with, separated by commas (eg base,iac,audit) |
| SPECTRAL_ENGINES | No | Engines list to run Spectral with, separated by commas (eg secrets,iac,oss). Default is 'secrets' |
| STRICT_MODE | No | If set to true, check status is based on all issues found in the modified files (even if the issues are old) |
Define the job in your .gitlab-ci.yml file, here is a basic YAML configuration example:
stages:
- test
spectral-scan:
stage: test
allow_failure: true
image: checkpoint/spectral-gitlab-pipeline-scanner:latest
variables:
GIT_STRATEGY: none
script:
- /usr/src/app/scanner
Define the desired triggers for the job using the rules property (every push to main branch, merge_request_event etc.).
NOTE: The advanced integration is currently supported only on Standalone GitLab servers.
In case you wish to secure your merge requests without using pipelines, you can use Spectral GitLab webhook scanner.
Content type
Image
Digest
sha256:8486765ee…
Size
39.3 MB
Last updated
about 3 years ago
docker pull checkpoint/spectral-gitlab-pipeline-scanner