-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(actions): adds support for rules in YAML format
Removes CSV based rule examples Removes CSV automation for rules Adds action to auto-transform adhoc and when the YAML is edited Adds a concurrency group to make sure branch modifying worflow are not run that the same time Signed-off-by: Jennifer Power <[email protected]>
- Loading branch information
Showing
14 changed files
with
135 additions
and
90 deletions.
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
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,11 @@ | ||
name: Run transform adhoc | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call-transform: | ||
uses: ./.github/workflows/transform-rules.yml | ||
with: | ||
branch: ${{ github.ref_name }} | ||
secrets: inherit |
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,18 @@ | ||
name: Transform Rules On Push | ||
|
||
# Only run on pushes to branches other than main. Pushes to main should be | ||
# a result of a pull request merge. The transform rules operation is not idempotent | ||
# and the OSCAL JSON will be modified each time it is run. | ||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
paths: | ||
- 'rules/**' | ||
|
||
jobs: | ||
call-transform: | ||
uses: ./.github/workflows/transform-rules.yml | ||
with: | ||
branch: ${{ github.ref_name }} | ||
secrets: inherit |
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,42 @@ | ||
name: Transform Rules | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
branch: | ||
required: true | ||
type: string | ||
|
||
# Using concurrency to ensure any branch-modifying workflows are not run at the same time. | ||
concurrency: | ||
group: sync-${{ inputs.branch }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
transform-rules: | ||
name: Transform rules content | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Generate app token | ||
uses: tibdex/github-app-token@v1 | ||
id: get_installation_token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.PRIVATE_KEY }} | ||
permissions: >- | ||
{"contents": "write"} | ||
- name: Clone | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.get_installation_token.outputs.token }} | ||
- name: Transform rules | ||
id: transform | ||
uses: jpower432/trestle-bot/actions/rules-transform@bug/single-rule-failure | ||
with: | ||
rules_view_path: "rules/" | ||
file_pattern: "*.json,rules/*" | ||
branch: ${{ inputs.branch }} | ||
commit_user_name: "trestle-bot[bot]" | ||
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com" |
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
name: Evaluate component definitions | ||
on: | ||
pull_request: | ||
types: [ opened, ready_for_review, reopened, synchronize ] | ||
branches: | ||
- main | ||
paths: | ||
- 'component-definitions/**' | ||
- 'markdown/components/**' | ||
- 'data/**' | ||
|
||
jobs: | ||
test: | ||
name: Evaluate components | ||
|
@@ -17,21 +16,20 @@ jobs: | |
steps: | ||
- name: Clone | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Check components | ||
id: check-components | ||
uses: RedHatProductSecurity/[email protected] | ||
with: | ||
markdown_path: "markdown/components" | ||
oscal_model: "compdef" | ||
check_only: true | ||
- name: CSV sanity check | ||
run: make check-csv | ||
|
||
# Only autofix if the test job fails and the PR is from the same repo | ||
call-autofix: | ||
needs: [test] | ||
if: ${{ always() && contains(needs.*.result, 'failure') }} | ||
if: | | ||
always() && contains(needs.*.result, 'failure') | ||
&& github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url | ||
uses: ./.github/workflows/autofix-cd.yml | ||
with: | ||
branch: ${{ github.head_ref }} | ||
|
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 |
---|---|---|
|
@@ -161,3 +161,6 @@ cython_debug/ | |
|
||
## Trestle Specifc | ||
.trestle/cache/ | ||
|
||
|
||
.vscode/ |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
x-trestle-rule-info: | ||
name: Test-rule_001 | ||
description: Ensure all of the services are running these tests | ||
parameter: | ||
name: prm_1 | ||
description: prm_1 description | ||
alternative-values: {'default': '5%', '5pc': '5%', '10pc': '10%', '15pc': '15%', '20pc': '20%'} | ||
default-value: '5%' | ||
profile: | ||
description: FedRAMP REV5 High Baseline | ||
href: profiles/fedramp_rev5_high/profile.json | ||
include-controls: | ||
- id: ac-1 | ||
x-trestle-component-info: | ||
name: Example | ||
description: Example Application | ||
type: service |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.