Skip to content

Commit

Permalink
chore: add yamllint to megalinter (#84)
Browse files Browse the repository at this point in the history
* chore: add yamllint to megalinter

* chore: update .mega-linter.yml to remove config argument

* chore: replace yamllint args with config

* fix: fixes yamllint rule violations

* Transform rules to OSCAL [skip-ci]

* Generate markdown changes [skip-ci]

* Sync automatic updates

* fix: removes trailing spaces

Signed-off-by: Jennifer Power <[email protected]>

* fix: replaces "skip-ci" with "skip ci" in transform-rules.yml

---------

Signed-off-by: Jennifer Power <[email protected]>
Co-authored-by: jpower432 <[email protected]>
Co-authored-by: trestle-bot[bot] <trestle-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 18, 2024
1 parent 865a021 commit bb6ea0b
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
schedule:
interval: "daily"
commit-message:
prefix: ":arrow_up:"
prefix: ":arrow_up:"
4 changes: 2 additions & 2 deletions .github/workflows/autofix-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Generate app token
uses: tibdex/[email protected]
id: get_installation_token
with:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
permissions: >-
Expand All @@ -40,4 +40,4 @@ jobs:
branch: ${{ inputs.branch }}
file_pattern: "*.json,markdown/*"
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
8 changes: 4 additions & 4 deletions .github/workflows/create-new.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Component Definitions Create
on:
workflow_dispatch:
inputs:
inputs:
import_name:
required: true
description: Name of profile in trestle workspace to be imported into the component definition
Expand All @@ -17,7 +17,7 @@ on:
filter_by_profile:
required: false
description: Filter the component definition control by a separate profile


jobs:
create-component:
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Generate app token
uses: tibdex/[email protected]
id: get_installation_token
with:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
permissions: >-
Expand All @@ -53,4 +53,4 @@ jobs:
commit_message: "adds ${{ github.event.inputs.component_name }} component to ${{ github.event.inputs.output }} component definition [skip ci]"
pull_request_title: "Add ${{ github.event.inputs.component_name }} component to ${{ github.event.inputs.output }} component definition"
github_token: ${{ steps.get_installation_token.outputs.token }}
filter_by_profile: ${{ github.event.inputs.filter_by_profile }}
filter_by_profile: ${{ github.event.inputs.filter_by_profile }}
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: MegaLinter
on:
push:
pull_request:
branches:
branches:
- main

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: ./.github/workflows/autofix-cd.yml
with:
branch: ${{ github.ref_name }}
secrets: inherit
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/manual-transform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: ./.github/workflows/transform-rules.yml
with:
branch: ${{ github.ref_name }}
secrets: inherit
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/transform-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
uses: ./.github/workflows/transform-rules.yml
with:
branch: ${{ github.ref_name }}
secrets: inherit
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/transform-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Generate app token
uses: tibdex/[email protected]
id: get_installation_token
with:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
permissions: >-
Expand All @@ -36,7 +36,7 @@ jobs:
with:
file_pattern: "*.json,rules/*"
branch: ${{ inputs.branch }}
commit_message: "Transform rules to OSCAL [skip-ci]"
commit_message: "Transform rules to OSCAL [skip ci]"
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
- name: Regenerate component definitions
Expand All @@ -47,6 +47,6 @@ jobs:
file_pattern: "markdown/*"
branch: ${{ inputs.branch }}
skip_assemble: true
commit_message: "Generate markdown changes [skip-ci]"
commit_message: "Generate markdown changes [skip ci]"
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
5 changes: 3 additions & 2 deletions .github/workflows/update-profiles.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Update upstream content

on:
on:
workflow_dispatch:

jobs:
Expand All @@ -11,7 +11,7 @@ jobs:
- name: Generate app token
uses: tibdex/[email protected]
id: get_installation_token
with:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
permissions: >-
Expand Down Expand Up @@ -45,3 +45,4 @@ jobs:
commit_message: "Generate markdown changes [skip ci]"
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"

4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
markdown_path: "markdown/components"
oscal_model: "compdef"
check_only: true

# Only autofix if the test job fails and the PR is from the same repo
call-autofix:
needs: [test]
Expand All @@ -37,4 +37,4 @@ jobs:
uses: ./.github/workflows/autofix-cd.yml
with:
branch: ${{ github.head_ref }}
secrets: inherit
secrets: inherit
1 change: 1 addition & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ENABLE_LINTERS:
- REPOSITORY_GITLEAKS
- ACTION_ACTIONLINT
- MARKDOWN_MARKDOWNLINT
- YAML_YAMLLINT
- BASH_SHELLCHECK
- REPOSITORY_KICS

Expand Down
5 changes: 5 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends: relaxed

rules:
line-length:
max: 105
26 changes: 15 additions & 11 deletions component-definitions/example/component-definition.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
"component-definition": {
"uuid": "231abb61-81ad-4c0e-b2a9-09128de8e67a",
"uuid": "3172756f-df6b-4f45-bb91-83c228963c1a",
"metadata": {
"title": "Component definition for example",
"last-modified": "2023-10-25T21:25:22+00:00",
"last-modified": "2024-03-15T00:07:34.346682+00:00",
"version": "1.0",
"oscal-version": "1.0.4"
},
"components": [
{
"uuid": "5c3e6d1f-8a90-42d4-97c4-9af36d916ae6",
"uuid": "7b595bb9-c6ec-409c-b109-95e71ddf2f56",
"type": "service",
"title": "Example",
"description": "Example Application",
"props": [
{
"name": "Rule_Id",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "Test-rule_001",
"remarks": "rule_set_0"
},
{
"name": "Rule_Description",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "Ensure all of the services are running these tests",
"remarks": "rule_set_0"
},
{
"name": "Parameter_Id",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "prm_1",
"remarks": "rule_set_0"
},
{
"name": "Parameter_Description",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "prm_1 description",
"remarks": "rule_set_0"
},
{
"name": "Parameter_Value_Alternatives",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "{'default': '5%', '5pc': '5%', '10pc': '10%', '15pc': '15%', '20pc': '20%'}",
"remarks": "rule_set_0"
}
],
"control-implementations": [
{
"uuid": "8f45e213-a818-4d61-80df-2b8563e3641d",
"uuid": "21db09e0-ce6f-4e67-9116-b2358a2f4074",
"source": "profiles/fedramp_rev5_high/profile.json",
"description": "FedRAMP REV5 High Baseline",
"set-parameters": [
Expand All @@ -60,14 +60,18 @@
],
"implemented-requirements": [
{
"uuid": "b34fa867-a4a9-44b1-86c5-d3517e8d8d81",
"uuid": "fac395f0-1a36-4c97-b7c4-805c08051a81",
"control-id": "ac-1",
"description": "",
"props": [
{
"name": "Rule_Id",
"ns": "https://ibm.github.io/compliance-trestle/schemas/oscal",
"ns": "https://oscal-compass.github.io/compliance-trestle/schemas/oscal",
"value": "Test-rule_001"
},
{
"name": "implementation-status",
"value": "planned"
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions markdown/components/example/Example/source_001/ac/ac-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ x-trestle-global:
title: FedRAMP Rev 5 High Baseline
href: profiles/fedramp_rev5_high/profile.json
sort-id: ac-01
x-trestle-rules-params:
Example:
- name: prm_1
description: prm_1 description
options: "{'default': '5%', '5pc': '5%', '10pc': '10%', '15pc': '15%', '20pc':
'20%'}"
rule-id: Test-rule_001
x-trestle-comp-def-rules-param-vals:
# You may set new values for rule parameters by adding
#
# component-values:
# - value 1
# - value 2
#
# below a section of values:
# The values list refers to the values as set by the components, and the component-values are the new values
# to be placed in SetParameters of the component definition.
#
Example:
- name: prm_1
values:
- 5%
---

# ac-1 - \[Access Control\] Policy and Procedures
Expand Down
2 changes: 1 addition & 1 deletion rules/example/Example/rule_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ x-trestle-rule-info:
x-trestle-component-info:
name: Example
description: Example Application
type: service
type: service

0 comments on commit bb6ea0b

Please sign in to comment.