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

refactor(create): replaces implementation for component definition cr… #56

Merged
merged 7 commits into from
Oct 26, 2023
Merged
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
42 changes: 16 additions & 26 deletions .github/workflows/create-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
inputs:
import_name:
required: true
description: Name of profile in trestle workspace to be imported
description: Name of profile in trestle workspace to be imported into the component definition
output:
required: true
description: Name of the component definition to create
Expand All @@ -14,7 +14,9 @@ on:
component_description:
required: true
description: Description of the component in the generated component definition

filter_by_profile:
required: false
description: Filter the component definition control by a separate profile


jobs:
Expand All @@ -34,33 +36,21 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ steps.get_installation_token.outputs.token }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: make trestlebot-install
- name: Create new component definition with imports
run: |
python3 scripts/set_default_comp.py --profile_name "${IMPORT_NAME}" \
--compdef_name "${OUTPUT}" --comp_title "${COMP_NAME}" --comp_description "${COMP_DESCRIPTION}" --trestle_root .
env:
OUTPUT: ${{ github.event.inputs.output }}
IMPORT_NAME: ${{ github.event.inputs.import_name }}
COMP_NAME: ${{ github.event.inputs.component_name }}
COMP_DESCRIPTION: ${{ github.event.inputs.component_description }}
- name: Generate and PR new component definition
id: generate-cd
uses: RedHatProductSecurity/trestle-bot/actions/[email protected]
- name: Create new component definition
id: create-cd
uses: RedHatProductSecurity/trestle-bot/actions/[email protected]
with:
markdown_path: "markdown/components"
oscal_model: "compdef"
branch: "component-create-${{ github.run_id }}"
profile_name: ${{ github.event.inputs.import_name }}
component_definition_name: ${{ github.event.inputs.output }}
component_title: ${{ github.event.inputs.component_name }}
component_description: ${{ github.event.inputs.component_description }}
file_pattern: "*.json,rules/*,markdown/*"
branch: component-create-${{ github.run_id }}
target_branch: "main"
file_pattern: "*.json,markdown/*"
skip_assemble: true
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
commit_message: "adds ${{ github.event.inputs.component_name }} component to ${{ github.event.inputs.output }} component definition"
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 }}
github_token: ${{ steps.get_installation_token.outputs.token }}
filter_by_profile: ${{ github.event.inputs.filter_by_profile }}
3 changes: 1 addition & 2 deletions .github/workflows/transform-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ jobs:
token: ${{ steps.get_installation_token.outputs.token }}
- name: Transform rules
id: transform
uses: RedHatProductSecurity/trestle-bot/actions/rules-transform@v0.3.0
uses: RedHatProductSecurity/trestle-bot/actions/rules-transform@v0.4.1
with:
rules_view_path: "rules/"
file_pattern: "*.json,rules/*"
branch: ${{ inputs.branch }}
commit_user_name: "trestle-bot[bot]"
Expand Down
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,4 @@ CONFIGS :=$(shell bash scripts/get_config_updates.sh)

update-subtree:
@git subtree pull --prefix vendor/ "$(REPO)" "$(BRANCH)" --squash
.PHONY: update-subtree

############################################################################
## Component Definition Custom tasks
############################################################################

trestlebot-install:
@python3 -m pip install --upgrade pip setuptools && python3 -m pip install -r requirements.txt
.PHONY: trestlebot-install
.PHONY: update-subtree
1 change: 0 additions & 1 deletion requirements.in

This file was deleted.

199 changes: 0 additions & 199 deletions requirements.txt

This file was deleted.

50 changes: 0 additions & 50 deletions scripts/set_default_comp.py

This file was deleted.