Skip to content
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

chore: Adds a schedule trigger to update-upstreams and updates Actions to use the trestlebot container image #67

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions .github/workflows/create-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
create-profile:
name: Create profile
runs-on: ubuntu-latest
container:
image: quay.io/continuouscompliance/trestle-bot:0.5.0
steps:
- name: Generate app token
uses: tibdex/[email protected]
Expand All @@ -34,12 +36,6 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ steps.get_installation_token.outputs.token }}
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install Trestlebot
run: python3 -m pip install --upgrade pip setuptools && python3 -m pip install -r requirements.txt
- name: Create new profile with imports
run: |
python3 scripts/set_default_profile.py --import_path "${IMPORT_TYPE}s/${IMPORT_NAME}/${IMPORT_TYPE}.json" \
Expand All @@ -48,19 +44,27 @@ jobs:
OUTPUT: ${{ github.event.inputs.output }}
IMPORT_NAME: ${{ github.event.inputs.import_name }}
IMPORT_TYPE: ${{ github.event.inputs.import_type }}
- name: Configure git to trust the github workspace
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Generate and PR new profile
id: generate-profile
uses: RedHatProductSecurity/trestle-bot/actions/[email protected]
with:
markdown_path: "markdown/profiles"
oscal_model: "profile"
branch: "profile-create-${{ github.run_id }}"
target_branch: "main"
file_pattern: "*.json,markdown/*"
skip_items: "fedramp_rev5_high"
skip_assemble: true
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
commit_message: "adds profile ${{ github.event.inputs.output }}"
pull_request_title: "Add profile ${{ github.event.inputs.output }}"
github_token: ${{ steps.get_installation_token.outputs.token }}
run: |
trestlebot-autosync \
--markdown-path="markdown/profiles" \
--oscal-model="profile" \
--commit-message="adds profile ${OUTPUT}" \
--pull-request-title="Add profile ${OUTPUT}" \
--branch="profile-create-${{ github.run_id }}" \
--file-patterns="*.json,markdown/*" \
--committer-name="trestle-bot[bot]" \
--committer-email="136850459+trestle-bot[bot]@users.noreply.github.com" \
--author-name="${{ github.actor }}" \
--author-email="${{ github.actor }}@users.noreply.github.com" \
--target-branch="main" \
--skip-items="fedramp_rev5_high" \
--skip-assemble \
--with-token - <<<"${GITHUB_TOKEN}"
env:
GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }}
OUTPUT: ${{ github.event.inputs.output }}
46 changes: 27 additions & 19 deletions .github/workflows/update-upstream.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Update content from upstream (NIST and FedRAMP)

on: workflow_dispatch
on:
workflow_dispatch:
# Schedule every Sunday at 5:00
schedule:
- cron: "0 5 * * 0"

env:
FEDRAMP_PROFILE_NAME: "fedramp_rev5_high"
NIST_CATALOG_NAME: "nist_rev5_800_53"
FEDRAMP_REPO_REF: "master"
FEDRAMP_REPO_REF: "d9cbac30174fa9d52540eba34425bdb5c18ff4d8"
NIST_REPO_REF: "690f517daaf3a6cbb4056d3cde6eae2756765620"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's decide what to do after the community meeting


jobs:
update:
name: Update content
runs-on: ubuntu-latest
container:
image: quay.io/continuouscompliance/trestle-bot:0.5.0
steps:
- name: Generate app token
uses: tibdex/[email protected]
Expand All @@ -25,12 +31,6 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ steps.get_installation_token.outputs.token }}
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install Trestle
run: python3 -m pip install --upgrade pip setuptools && python3 -m pip install -r requirements.txt
- name: Update catalogs
run: |
rm -rf "catalogs/${NIST_CATALOG_NAME}"
Expand All @@ -40,16 +40,24 @@ jobs:
rm -rf "profiles/${FEDRAMP_PROFILE_NAME}"
trestle import -f "https://raw.githubusercontent.com/GSA/fedramp-automation/${FEDRAMP_REPO_REF}/dist/content/rev5/baselines/json/FedRAMP_rev5_HIGH-baseline_profile.json" -o "${FEDRAMP_PROFILE_NAME}"
trestle href --name "${FEDRAMP_PROFILE_NAME}" -hr "trestle://catalogs/${NIST_CATALOG_NAME}/catalog.json"
- name: Configure git to trust the github workspace
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Update content
uses: RedHatProductSecurity/trestle-bot/actions/[email protected]
uses: peter-evans/[email protected]
with:
markdown_path: "markdown/profiles"
oscal_model: "profile"
file_pattern: "*.json"
branch: "autoupdate-${{ github.run_id }}"
target_branch: "main"
skip_assemble: true
skip_regenerate: true
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
github_token: ${{ steps.get_installation_token.outputs.token }}
base: main
branch: "oscal-update-${{ github.run_id }}"
delete-branch: true
commit-message: "Update OSCAL content from upstream"
title: "Update upstream OSCAL content from usnistogv and GSA"
token: ${{ steps.get_installation_token.outputs.token }}
body: |
Updates upstream OSCAL content
- usnistgov NIST 800-53
- GSA FedRAMP OSCAL profiles

Auto-generated by the `update-upstream` workflow.
add-paths: |
"catalogs/${NIST_CATALOG_NAME}"
"profiles/${FEDRAMP_PROFILE_NAME}"
1 change: 0 additions & 1 deletion requirements.in

This file was deleted.

202 changes: 0 additions & 202 deletions requirements.txt

This file was deleted.