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(oscal): begin integration of composed oscal with validations #496

Merged
merged 86 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ec76296
feat(oscal): begin integration of composed oscal with validations
brandtkeller Jun 19, 2024
f8eb050
Merge branch 'main' into 458_lula-integration-istio
CloudBeard Jun 28, 2024
b43e6df
renamed /src/istio oscal, created root compliance dir, pre-composed r…
CloudBeard Jun 28, 2024
ee8bc28
added install lula github action
CloudBeard Jun 28, 2024
fa05cd4
still working on where/how to oscal lint
CloudBeard Jun 28, 2024
315f271
still wip for lint
CloudBeard Jun 28, 2024
765c727
feat(oscal): import all available oscal - fix workflows
brandtkeller Jun 30, 2024
bd41e3a
chore(oscal): tagged lint import / fixed path to action
brandtkeller Jun 30, 2024
2704b4c
chore(oscal): fix action path
brandtkeller Jun 30, 2024
e9631e0
chore(oscal): add shell property
brandtkeller Jun 30, 2024
49b8b8a
chore(oscal): add shell property to action
brandtkeller Jun 30, 2024
550a76c
chore(oscal): updating lint workflow/action
brandtkeller Jun 30, 2024
b99023c
chore(oscal): add fetch depth to checkout
brandtkeller Jun 30, 2024
12326d9
chore(oscal): update run-lint-oscal job
brandtkeller Jun 30, 2024
2edb4c2
chore(oscal): update step conditional
brandtkeller Jun 30, 2024
97751dc
chore(oscal): update step conditional with template brackets
brandtkeller Jun 30, 2024
a27725d
chore(oscal): testing conditional outputs
brandtkeller Jun 30, 2024
6f9326d
chore(oscal): test alternate test step
brandtkeller Jun 30, 2024
145d1de
chore(oscal): fix conditional job
brandtkeller Jun 30, 2024
90c561a
chore(oscal): default to paths-filter for vars
brandtkeller Jun 30, 2024
059ca50
chore(oscal): default to paths-filter for vars with list files
brandtkeller Jun 30, 2024
50fed3d
chore(oscal): default to paths-filter csv
brandtkeller Jun 30, 2024
f8f6cab
chore(oscal): filter path-filters results
brandtkeller Jun 30, 2024
8cc845b
chore(oscal): install uds in job for linting
brandtkeller Jun 30, 2024
e099dda
chore(oscal): fix task linting
brandtkeller Jun 30, 2024
114cac2
chore(oscal): install lula
brandtkeller Jun 30, 2024
2847a15
chore(oscal): additional path-filters check for oscal files
brandtkeller Jun 30, 2024
13f8cb6
chore(oscal): update conditional needs for job
brandtkeller Jun 30, 2024
678460c
chore(oscal): begin integrating validate to single-package
brandtkeller Jun 30, 2024
70cdcb8
Merge branch 'main' of github.com:defenseunicorns/uds-core into 458_l…
brandtkeller Jun 30, 2024
2fc9c7b
chore(oscal): update oscal for validation
brandtkeller Jun 30, 2024
fcec799
chore(oscal): instrument compliance gate for required adherence
brandtkeller Jul 1, 2024
762028c
think I moved oscal lint to a different workflow
CloudBeard Jul 1, 2024
baf3d40
moved command into workflow
CloudBeard Jul 1, 2024
1f90398
chore(oscal): revert changes to pull request conditionals workflow
brandtkeller Jul 1, 2024
5faca4b
chore(oscal): fix comment block to revert changes
brandtkeller Jul 1, 2024
e8c1178
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 3, 2024
cf240d3
chore(oscsal): update workflows to separate tasks
brandtkeller Jul 3, 2024
f0b1d57
chore(oscal): update workflows and composed oscal
brandtkeller Jul 3, 2024
733d70b
fix(oscal): update task syntax
brandtkeller Jul 3, 2024
3d98c96
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 8, 2024
902e735
fix(oscal): decouple file extraction for CI
brandtkeller Jul 8, 2024
79e76e3
fix(actions): update actions to include continue and notify
brandtkeller Jul 8, 2024
090548f
fix(actions): pin actions to tag commit hash
brandtkeller Jul 8, 2024
9d9ead8
fix(actions): yamllint fix
brandtkeller Jul 9, 2024
a00c68e
chore(oscal): update istio oscal
brandtkeller Jul 9, 2024
e2c0a5e
chore(oscal): update to new threshold
brandtkeller Jul 9, 2024
a00e1c6
fix(oscal): purposefully fail assessment to drive new workflow actions
brandtkeller Jul 9, 2024
52d2520
fix(actions): use outcome over conclusion
brandtkeller Jul 9, 2024
8345c88
fix(actions): adjust permissions and add token
brandtkeller Jul 9, 2024
0604cbc
fix(actions): update permissions
brandtkeller Jul 9, 2024
2d50d1f
fix(actions): testing separate job for evaluation
brandtkeller Jul 9, 2024
f87e866
fix(actions): move continue on error
brandtkeller Jul 9, 2024
4273d86
fix(lint): yamllint fixes
brandtkeller Jul 9, 2024
812a44f
fix(actions): remove conditional from evaluate
brandtkeller Jul 9, 2024
fe29f38
fix(actions): setup environment properly
brandtkeller Jul 9, 2024
1daec53
fix(actions): path use in download action
brandtkeller Jul 9, 2024
6c01e0c
fix(actions): correct step conditional
brandtkeller Jul 9, 2024
aca97e4
fix(actions): pin upload to v4.2.0 due to bug
brandtkeller Jul 9, 2024
6f0ac13
fix(oscal): test upload/download at v4.0.0
brandtkeller Jul 9, 2024
a169ae2
fix(actions): test using known good versions
brandtkeller Jul 9, 2024
1018fb5
fix(actions): testing v4 tag upload/download
brandtkeller Jul 9, 2024
98f1ffe
fix(actions): test removing overlapping file
brandtkeller Jul 9, 2024
815c2c3
fix(actions): debug download artifact action
brandtkeller Jul 10, 2024
64a7128
fix(actions): latest actions and debugging
brandtkeller Jul 10, 2024
237f38c
fix(oscal): revert to known good state
brandtkeller Jul 10, 2024
fa7a349
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 10, 2024
2d094c5
fix(actions): cleanup for review
brandtkeller Jul 10, 2024
56c1b64
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 10, 2024
56df08f
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 11, 2024
edd02f2
fix(oscal): update validations to meet established threshold after ch…
brandtkeller Jul 12, 2024
247b3eb
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 12, 2024
d2bc20a
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 12, 2024
9735096
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 12, 2024
1c9e855
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 12, 2024
0aed284
fix(actions): add unicorn flavor to evaluation
brandtkeller Jul 12, 2024
6852bd2
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 15, 2024
1a9e9df
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 15, 2024
2aa285d
fix(oscal): update oscal validations for istio injection
brandtkeller Jul 16, 2024
5c10ecf
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 16, 2024
9a9c197
Merge branch 'main' into 458_lula-integration-istio
mjnagel Jul 16, 2024
8da2072
Update .github/workflows/pull-request-conditionals.yaml
brandtkeller Jul 16, 2024
ce87762
chore(tasks): add descriptions to compliance tasks
brandtkeller Jul 18, 2024
b99457f
merge main into feature branch 458_lula-integration-istio
brandtkeller Jul 18, 2024
ed6da0d
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 19, 2024
ed88274
Merge branch 'main' into 458_lula-integration-istio
brandtkeller Jul 19, 2024
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
51 changes: 51 additions & 0 deletions .github/actions/notify-lula/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Notify Lula
description: "Comment on PR to notify Lula Team"


inputs:
state:
description: 'state of the comment update'
required: true
default: ''
flavor:
description: 'flavor of the comment update'
required: true
default: ''
ghToken:
description: 'GITHUB_TOKEN'
required: true

runs:
using: composite
steps:
- name: Find Comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Compliance ${{ inputs.flavor }} Evaluation
token: ${{ inputs.ghToken }}

- name: Create comment
if: ${{ steps.fc.outputs.comment-id == '' && inputs.state == 'failure'}}
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
token: ${{ inputs.ghToken }}
body: |
Compliance ${{ inputs.flavor }} Evaluation: ${{ inputs.state }}

CC: @defenseunicorns/lula-dev

- name: Update comment
if: ${{ steps.fc.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
token: ${{ inputs.ghToken }}
edit-mode: replace
body: |
Compliance ${{ inputs.flavor }} Evaluation: ${{ inputs.state }}

CC: @defenseunicorns/lula-dev
mjnagel marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ runs:
# renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver
run: brew install defenseunicorns/tap/[email protected]

- name: Install Lula
uses: defenseunicorns/lula-action/setup@095636b7880051e11b05f10a582fdd911526161c
with:
# renovate: datasource=github-tags depName=defenseunicorns/lula versioning=semver-coerced
version: v0.4.1

- name: Iron Bank Login
if: ${{ inputs.registry1Username != '' }}
env:
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/compliance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Compliance Evaluation

on:
# Manual trigger
workflow_dispatch:
inputs:
flavor:
type: string
description: "Flavor of the source package to test"
required: true
# Triggered by pull-request-conditionals.yaml
workflow_call:
inputs:
flavor:
type: string
description: "Flavor of the source package to test"
required: true

permissions:
contents: read
pull-requests: write

jobs:
evaluate:
runs-on: ubuntu-latest
name: Evaluate
continue-on-error: true
# env:
# UDS_PKG: ${{ inputs.package }}
steps:
# Used to execute the uds run command
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Environment setup
uses: ./.github/actions/setup

- name: review compliance directory
run: ls -al ./compliance/
shell: bash

- name: remove overlapping file
run: rm ./compliance/oscal-assessment-results.yaml
shell: bash

- name: Download assessment
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.flavor }}-assessment-results
path: ./compliance

- name: review compliance directory again
run: ls -al ./compliance/
shell: bash

- name: Evaluate compliance
id: compliance-evaluation
run: uds run test-compliance-evaluate --no-progress

# steps in this action only run when there has been a previous failure - will indicate success thereafter
# need to think about how much noise this could create - noise currently = good
- name: Notify Lula Team of Compliance Assessment Results
if: ${{ always() }}
uses: ./.github/actions/notify-lula
with:
state: ${{ steps.compliance-evaluation.outcome }}
flavor: ${{ inputs.flavor }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Evaluated Assessment
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: ${{ inputs.flavor }}-assessment-results
path: ./compliance/oscal-assessment-results.yaml
overwrite: true
56 changes: 56 additions & 0 deletions .github/workflows/lint-oscal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lint OSCAL Files

on:
pull_request:
# milestoned is added here as a workaround for release-please not triggering PR workflows (PRs should be added to a milestone to trigger the workflow).
types: [milestoned, opened, reopened, synchronize]
paths:
- '**/*oscal*.yaml'

permissions:
contents: read

jobs:

check-oscal-paths:
runs-on: ubuntu-latest
name: OSCAL Change Detection
outputs:
oscal: ${{ steps.path-filter.outputs.oscal }}
oscal_files: ${{ steps.path-filter.outputs.oscal_files }}
steps:
- name: Checkout the code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Uses a custom action to filter paths for source packages.
- name: Check src paths
id: path-filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
with:
filters: |
oscal:
- added|modified: "**/*oscal*.yaml"
list-files: shell

lint-oscal:
needs: check-oscal-paths
if: ${{ needs.check-oscal-paths.outputs.oscal == 'true' }}
runs-on: ubuntu-latest
steps:
# filter the files to remove not oscal files (such as those titles oscal-* under ./.github)
- name: Identify changed OSCAL files
id: find_changed_files
run: |
CHANGED_FILES=$(echo "${{ needs.check-oscal-paths.outputs.oscal_files }}" | tr ' ' '\n' | grep -v ".github*" | tr '\n' ',' | sed 's/.$//' || true)
echo "Changed OSCAL files: $CHANGED_FILES"
echo "oscal_files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
shell: bash
# checkout for access to the oscal files targeted for linting
- name: Checkout the code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Environment setup
uses: ./.github/actions/setup
# lint the oscal files
- name: lint-oscal
run: uds run lint-oscal --set OSCALFILES=${{ steps.find_changed_files.outputs.oscal_files }} --no-progress
shell: bash
14 changes: 13 additions & 1 deletion .github/workflows/pull-request-conditionals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
permissions:
id-token: write # Needed for OIDC-related operations.
contents: read # Allows reading the content of the repository.
pull-requests: read # Allows reading pull request metadata.
pull-requests: write # Allows writing pull request metadata.
packages: read # Allows reading the published GHCR packages

# Default settings for all run commands in the workflow jobs.
Expand Down Expand Up @@ -86,3 +86,15 @@ jobs:
flavor: ${{ matrix.flavor }}
test_type: ${{ matrix.test_type }}
secrets: inherit # Inherits all secrets from the parent workflow.

evaluate-package-compliance:
needs: run-package-test
name: Compliance Evaluation
strategy:
matrix:
flavor: [upstream, registry1, unicorn]
brandtkeller marked this conversation as resolved.
Show resolved Hide resolved
fail-fast: false
uses: ./.github/workflows/compliance.yaml
with:
flavor: ${{ matrix.flavor }}
secrets: inherit # Inherits all secrets from the parent workflow.
11 changes: 11 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ jobs:
if: ${{ inputs.package == 'all' && inputs.test_type == 'install' }}
run: uds run test-uds-core --set FLAVOR=${{ inputs.flavor }} --no-progress

- name: Validate UDS Core Compliance
if: ${{ inputs.package == 'all' && inputs.test_type == 'install' }}
run: uds run test-compliance-validate --no-progress

- name: Upload Assessment
if: ${{ inputs.package == 'all' && inputs.test_type == 'install' }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: ${{ inputs.flavor }}-assessment-results
path: ./compliance/oscal-assessment-results.yaml

- name: Test UDS Core Upgrade
if: ${{ inputs.package == 'all' && inputs.test_type == 'upgrade' }}
run: uds run test-uds-core-upgrade --set FLAVOR=${{ inputs.flavor }} --no-progress
Expand Down
Loading