Skip to content

Commit

Permalink
docs: updates README.md with Getting Started and design info (#91)
Browse files Browse the repository at this point in the history
* docs: updates README.md with Getting Started and design info

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

* docs: align terminology with trestle-bot command names

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

* docs: updates master branch to main the README.md

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

---------

Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 authored May 23, 2024
1 parent 5c94c94 commit 0969fd9
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Profile Autofix
name: Profile autosync

on:
workflow_call:
Expand All @@ -13,7 +13,7 @@ concurrency:

jobs:
auto-update:
name: Autofix profile content
name: autosync profile content
runs-on: ubuntu-latest
steps:
- name: Generate app token
Expand All @@ -29,8 +29,8 @@ jobs:
with:
ref: ${{ inputs.branch }}
token: ${{ steps.get_installation_token.outputs.token }}
- name: Autofix profile
id: autofix-profile
- name: autosync profile
id: autosync-profile
uses: RedHatProductSecurity/trestle-bot/actions/[email protected]
with:
markdown_path: "markdown/profiles"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Run autofix adhoc
name: Run autosync adhoc

on:
workflow_dispatch:

jobs:
call-autofix:
uses: ./.github/workflows/autofix-profile.yml
call-autosync:
uses: ./.github/workflows/autosync-profile.yml
with:
branch: ${{ github.ref_name }}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
check_only: true
skip_items: "fedramp_rev5_high"

call-autofix:
call-autosync:
needs: [test]
if: |
always() && contains(needs.*.result, 'failure')
&& github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url
uses: ./.github/workflows/autofix-profile.yml
uses: ./.github/workflows/autosync-profile.yml
with:
branch: ${{ github.head_ref }}
secrets: inherit
129 changes: 61 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,64 @@ OSCAL Custom Profiles for testing with FedRAMP REV5 HIGH baseline profile.

> WARNING: Cloud Service Model derived profiles are experimental and have not been validated.
## Directory Structure

### Content Managed by Automation

Some the directories in this repository are managed through automated processes such as make targets or GitHub Actions.

- catalogs: This stores OSCAL Catalogs installed in the trestle workspace.
- profiles (FedRAMP only) - This stores OSCAL Profiles installed in the trestle workspace.


For information on how this data is managed, see the [FAQs](./docs/faqs.md).

### Content Managed by Control Owner (i.e. managed directly in this repository)
- markdown - This stores profile information that can be edited directly.
- profiles - This stores custom OSCAL Profile JSON installed in the trestle workspace.
- scripts - This stores bash scripts for automation tasks unique to this repository.

## Workflow

The below diagram depict the event-driven pull-based strategy used to update the content in this repository.

```mermaid
graph LR
subgraph Trestle_Workspace
Catalogs(Catalogs)
Profiles(Profiles)
Upstream_Profiles(Upstream Profiles)
end
subgraph External Sources
Official_Catalogs_Profiles(Official OSCAL Catalogs and Profiles)
end
subgraph GitHub Actions
Catalog_Profile_Import(Catalog/Profile Import)
subgraph Trestle Bot
Commit(Commit)
Create_Pull_Request(Create Pull Request)
Sync_Profiles(Sync Profiles with Catalogs)
Sync_Profiles_P(Sync Profiles with Upstream Profiles)
end
end
subgraph Review and Approval
Pull_Request(Pull Request)
end
Person(Person)
Official_Catalogs_Profiles --> Catalog_Profile_Import
Catalog_Profile_Import --> A{Content Updates?}
A -- Yes --> Commit
Commit --> Create_Pull_Request
Create_Pull_Request --> Person
A -- No --> B[End]
Sync_Profiles -- Catalog Content --> A
Sync_Profiles_P -- Profile Content --> A
Pull_Request -- Merge --> Catalogs
Pull_Request -- Merge --> Profiles
Pull_Request -- Merge --> Upstream_Profiles
Catalogs -- Workflow Dispatched --> Sync_Profiles
Upstream_Profiles -- Workflow Dispatched --> Sync_Profiles_P
Person -- Review --> Pull_Request
Person -- Approve --> Pull_Request
Profiles --> B
```

### Current Limitations:

- Catalogs and profiles currently have to be synced by manually executing a GitHub Action workflow.

To complete work from a fork, local automation is available. To see the available make targets, use `make help`. For information on how to edit the content in this repository, see the [tutorial](./docs/tutorial.md).
## Getting Started

### Update Existing Content
#### Overview
The workflow to update content consists of the following steps:

1. From a user's branch, modify and commit a markdown or json file within the workspace. (Most updates will be made to markdown files.)
2. A user submits a pull request to add their changes to the workspace's main branch.
3. From a user's branch, trestle-bot synchronizes the workspace content, validates it, and formats it.
4. The workspace updates are conditionally added to the workspace's main branch.


#### Step 1: Create and switch to a new branch
The first step in modifying content is to [create a new branch](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository) of the workspace to save your work to.

#### Step 2: Locate content
Once you've created a branch, locate the content to be modified within the workspace. JSON and markdown files can be found in the following places:
- `./markdown/profiles/`
- `./profiles/`


#### Step 3: Modify content
Browse to the referenced file. Follow your Git Provider's instructions for committing changes to a file.
- [GitHub](https://docs.github.com/en/github/managing-files-in-a-repository/editing-files-in-your-repository)


#### Step 4: Open A pull request
Once the needed modifications have been performed, request to publish the changes by opening a pull request to merge your changes into the workspace's main branch.

- [GitHub](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)


#### Step 5: Approve and merge pull request
Once trestle-bot has processed the workspace modifications, the pull request can be conditionally approved, which triggers the publishing of the changes to the workspace's main branch.

- [GitHub](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/approving-a-pull-request-with-required-reviews)


### Creating new content
#### Overview
The workflow to create a new Profile consists of the following steps:

1. Using the GitHub UI, complete a create new profile form and submit it to trestle-bot.
2. trestle-bot processes the form and creates a new profile within the workspace.
3. trestle-bot opens a pull request to add the new profile to the workspace's main branch.
4. The workspace updates are conditionally added to the workspace's main branch.


#### Step 1: Kickoff a workflow
Use your git provider's UI to kickoff a workflow, by browsing to the workspace's available workflows and selecting the `Profile Create` workflow. Enter the required information and submit the form to run the workflow.
[GitHub](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow)


#### Step 2: Approve and merge pull request
Once trestle-bot has processed the workspace modifications, the pull request can be conditionally approved, which triggers the publishing of the changes to the workspace's main branch.

- [GitHub](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/approving-a-pull-request-with-required-reviews)

## FAQs and Infrequent Tasks

See [FAQs and Infrequent Tasks](./docs/faqs.md) for more information.
41 changes: 41 additions & 0 deletions docs/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Design

In the repository, GitHub Actions is used to manage the trestle workspace. This document describes the purpose and design of each workflow.

## Workflows

#### Create

Associated Workflows
- [create-new.yml](../.github/workflows/create-new.yml)

The `create-new` workflow is triggered manually by going to the Action tab. This creates a new OSCAL profile in the trestle workspace. A new branch is created and a pull request is opened.

#### Autosync content

Associated Workflows
- [autosync-profile.yml](../.github/workflows/autosync-profile.yml)
- [manual-autosync.yml](../.github/workflows/manual-autosync.yml)
- [validate.yml](../.github/workflows/validate.yml)

The `validate` workflow is triggered when a pull request is created or updated with updates to component definitions. It validates the trestle workspace and automatically sync any difference between the OSCAL JSON files and trestle managed Markdown files. The same workflow can be triggered through the Action tab using the `Run autosync adhoc` workflow. The `autosync-profile.yml` has all common logic for both workflows. The `validate.yml` and `manual-autosync.yml` workflows adds customer triggers and logic.

The `validate` workflow will run checks with read-only permissions when a pull request is opened from a from a fork, but the autosync workflow will not run.

#### Update Profile

Associated Workflows
- [update-upstream.yml](../.github/workflows/update-upstream.yml)

The `update-uptream` workflow is triggered manually to pull in updated profile and catalog information from upstream sources. This will update the profile information in the trestle workspace and open a pull request.

#### Release

Associated Workflows
- [dispatch.yml](../.github/workflows/dispatch.yml)
- [release.yml](../.github/workflows/release.yml)


The `release` workflow is triggered manually to assign a release version to the profiles in the repository. The artifacts are synced, version and changes are push back to the branch. An associated tag for the release is created and a GitHub release is created. Once, the release is publish, the `dispatch` workflow is triggered to notfiy downstream repositories.


37 changes: 0 additions & 37 deletions docs/tutorial.md

This file was deleted.

0 comments on commit 0969fd9

Please sign in to comment.