Skip to content

Commit

Permalink
docs(repo): add gitlab instructions to ci docs (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
snim2 authored Aug 8, 2022
1 parent 75ef3e2 commit 05ee443
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/guides/8-continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ Learn more about [CircleCI Configuration](https://circleci.com/docs/2.0/config-i

Spectral has a pre-built [Spectral GitHub Action](https://github.com/stoplightio/spectral-action) which should speed up implementing Spectral in your GitHub repository.

## GitLab

GitLab users can add the following to their `.gitlab-ci.yml` files:

```yaml
stages:
- lint
lint:spectral:
stage: lint
image:
name: stoplight/spectral
entrypoint: [""]
script:
- spectral lint -D -f junit -o spectral-report.xml openapi.yaml
artifacts:
when: always
expire_in: 2 weeks
reports:
junit: $CI_PROJECT_DIR/spectral-report.xml
```

Note that this CI job exposes Spectral results on the merge request page, along with any other test output you may have. To ensure that GitLab can parse the output of spectral, we use the `-f junit`flag.

You will also need to edit your `openapi.yaml` file to point to the particular documents you want to lint.

## Jenkins

Instructions coming soon...

0 comments on commit 05ee443

Please sign in to comment.