-
Notifications
You must be signed in to change notification settings - Fork 35
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
CICD Docs (Github/Gitlab) #743
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cbfd927
start adding cicd docs for regal
Parsifal-M eb217d6
adds CICD Docs for Regal!
Parsifal-M 97340ad
Merge branch 'main' into docs/cicd-docs
Parsifal-M cceac0f
fixes typo in messy rule docs
Parsifal-M f0bfda8
fixing whitespace issue
Parsifal-M b7537f0
Merge branch 'main' into docs/cicd-docs
Parsifal-M fc6be4f
updated based on feedback
Parsifal-M 47eb1c5
line length fix
Parsifal-M b2fbf4f
trailing spaces fix
Parsifal-M File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Using Regal in your build pipeline | ||
|
||
Its possible to use Regal to lint your Rego policies in your CI/CD pipeline(s)! | ||
|
||
This document will guide you on how to do so. | ||
|
||
## GitHub Actions | ||
|
||
If you'd like to run Regal in GitHub actions, please consider using [`setup-regal`](https://github.com/StyraInc/setup-regal). | ||
A simple `.github/workflows/lint.yml` to run regal on PRs could look like this, where `policy` contains Rego files: | ||
|
||
```yaml | ||
name: Regal Lint | ||
on: | ||
pull_request: | ||
jobs: | ||
lint-rego: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: StyraInc/setup-regal@v1 | ||
with: | ||
# For production workflows, use a specific version, like v0.22.0 | ||
version: latest | ||
|
||
- name: Lint | ||
run: regal lint --format=github ./policy | ||
``` | ||
|
||
Please see [`setup-regal`](https://github.com/StyraInc/setup-regal) for more information. | ||
|
||
## GitLab CICD | ||
|
||
To use Regal in GitLab CI/CD, you could for example use the following stage in your `.gitlab-ci.yml`: | ||
|
||
```yaml | ||
regal_lint_policies: | ||
stage: regal-lint | ||
image: | ||
# For production workflows, use a specific version, like v0.22.0 | ||
name: ghcr.io/styrainc/regal:latest | ||
entrypoint: ['/bin/sh', '-c'] | ||
script: | ||
- regal lint ./policy | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' | ||
``` | ||
|
||
The above will run Regal on the `policy` directory when a merge request is created or updated. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably obvious to someone who uses GitLab, but the GH example above specifically mentions running Regal on PRs, while this sentence says nothing about when/how this is triggered. Could you add that? 🙂