Skip to content

Commit 7809f26

Browse files
Merge pull request #1 from complytime/initial-automation
feat: initial automation to create content with Actions
2 parents 2d17516 + 4434322 commit 7809f26

File tree

12 files changed

+133
-0
lines changed

12 files changed

+133
-0
lines changed

.github/workflows/sync-comp.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CaC to OSCAL Component Definition
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
cac-reference:
6+
description: 'ComplianceAsCode git reference'
7+
required: true
8+
default: 'master'
9+
oscal-profile:
10+
required: true
11+
description: Name of profile in trestle workspace to be imported into the component definition
12+
product:
13+
required: true
14+
description: Name of the product in CaC content to process
15+
cac-profile-id:
16+
required: true
17+
description: Profile ID under product in CaC content to process
18+
component-type:
19+
required: false
20+
default: "software"
21+
description: Type of component definition (defaults to "software")
22+
23+
permissions: read-all
24+
25+
jobs:
26+
update-component:
27+
name: Create component definition
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
container:
32+
image: quay.io/continuouscompliance/trestle-bot:dev-main-0ceeb01
33+
steps:
34+
- name: Clone
35+
uses: actions/checkout@v4
36+
with:
37+
path: complytime-content
38+
- name: Checkout CaC repo
39+
uses: actions/checkout@v4
40+
with:
41+
repository: ComplianceAsCode/content
42+
ref: ${{ github.event.inputs.cac-reference }}
43+
path: content
44+
- name: Update component definition
45+
working-directory: ./complytime-content
46+
env:
47+
OSCAL_PROFILE: ${{ github.event.inputs.oscal-profile }}
48+
PRODUCT: ${{ github.event.inputs.product}}
49+
CAC_PROFILE: ${{ github.event.inputs.cac-profile-id }}
50+
TYPE: ${{ github.event.inputs.component-type }}
51+
CAC_CONTENT_ROOT: ${{ github.workspace }}/content
52+
ACTOR: ${{ github.actor }}
53+
run: |
54+
trestlebot sync-cac-content component-definition \
55+
--cac-content-root "$CAC_CONTENT_ROOT" \
56+
--cac-profile "$CAC_CONTENT_ROOT/products/$PRODUCT/profiles/$CAC_PROFILE.profile" \
57+
--oscal-profile $OSCAL_PROFILE \
58+
--product "$PRODUCT" \
59+
--component-definition-type "$TYPE" \
60+
--author-name="$ACTOR" \
61+
--author-email="[email protected]" \
62+
--file-patterns="component-definitions/*"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CaC to OSCAL Control Models
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
cac-reference:
6+
description: ComplianceAsCode git reference
7+
required: true
8+
default: 'master'
9+
policy-id:
10+
required: true
11+
description: Name of CaC control policy to process
12+
product:
13+
required: true
14+
description: Name of CaC product to process
15+
16+
permissions: read-all
17+
18+
jobs:
19+
update-controls:
20+
name: Update control data
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
container:
25+
image: quay.io/continuouscompliance/trestle-bot:dev-main-0ceeb01
26+
steps:
27+
- name: Clone
28+
uses: actions/checkout@v4
29+
with:
30+
path: complytime-content
31+
- name: Checkout CaC repo
32+
uses: actions/checkout@v4
33+
with:
34+
repository: ComplianceAsCode/content
35+
ref: ${{ github.event.inputs.cac-reference }}
36+
path: content
37+
- name: Update catalog
38+
working-directory: ./complytime-content
39+
env:
40+
POLICY: ${{ github.event.inputs.policy-id }}
41+
ACTOR: ${{ github.actor }}
42+
run: |
43+
trestlebot sync-cac-content catalog \
44+
--cac-content-root "$GITHUB_WORKSPACE/content" \
45+
--policy-id "$POLICY" \
46+
--oscal-catalog "$POLICY" \
47+
--author-name="$ACTOR" \
48+
--author-email="[email protected]" \
49+
--file-patterns="catalogs/*"
50+
- name: Update profile
51+
working-directory: ./complytime-content
52+
env:
53+
POLICY: ${{ github.event.inputs.policy-id }}
54+
PRODUCT: ${{ github.event.inputs.product}}
55+
ACTOR: ${{ github.actor }}
56+
run: |
57+
trestlebot sync-cac-content profile \
58+
--cac-content-root "$GITHUB_WORKSPACE/content" \
59+
--policy-id "$POLICY" \
60+
--oscal-catalog "$POLICY" \
61+
--product "$PRODUCT" \
62+
--author-name="$ACTOR" \
63+
--author-email="[email protected]" \
64+
--file-patterns="profiles/*"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.trestle/cache

.trestle/.keep

Whitespace-only changes.

.trestlebot/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
branch: develop
2+
commit_message: Automatic updates from trestlebot!
3+
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
4+
committer_name: github-actions[bot]
5+
markdown_dir: markdown/

assessment-plans/.keep

Whitespace-only changes.

assessment-results/.keep

Whitespace-only changes.

catalogs/.keep

Whitespace-only changes.

component-definitions/.keep

Whitespace-only changes.

plan-of-action-and-milestones/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)