Skip to content

Commit

Permalink
feat: updated workflows and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Kruggel committed May 3, 2024
1 parent b8e14ce commit ff9ed06
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 138 deletions.
18 changes: 0 additions & 18 deletions .github/actions/save-logs/action.yaml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/actions/setup/action.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/ci-docs-shim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI Docs Shim

on:
pull_request:
branches: [main]
types: [milestoned, opened, synchronize]

jobs:
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
runs-on: "ubuntu-latest"
timeout-minutes: 20
strategy:
matrix:
flavor: [upstream, registry1]
type: [install, upgrade]
steps:
- name: Shim for ${{ matrix.type }} ${{ matrix.flavor }}
run: |
echo "Documentation-only change detected; marking ${{ matrix.type }} ${{ matrix.flavor }} as successful."
29 changes: 8 additions & 21 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
name: Metadata

on:
# This workflow is triggered on pull requests to the main branch.
pull_request:
branches: [main]
types: [opened, edited, synchronize]
types: [milestoned, opened, edited, synchronize]

jobs:
title_check:
runs-on: ubuntu-latest
name: Validate PR Title
permissions:
pull-requests: read

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
# This allows other repositories to call this workflow in a reusable way
workflow_call:

- name: Install commitlint
run: npm install --save-dev @commitlint/{config-conventional,cli}

- name: Lint PR title
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
jobs:
validate:
name: Validate
uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
35 changes: 35 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Scan

on:
# This workflow is triggered on pull requests to the main branch.
pull_request:
branches: [main]
types: [milestoned, opened, synchronize]

jobs:
validate:
runs-on: ubuntu-latest
name: Lint
permissions:
contents: read # Allows reading the repo contents

steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Install lint deps
run: |
uds run lint:deps
- name: Lint the repository
run: |
uds run lint:yaml
50 changes: 50 additions & 0 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
branch_protection_rule:
schedule:
- cron: '30 1 * * 6'
push:
branches: ["main"]

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge.
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
with:
sarif_file: results.sarif
33 changes: 16 additions & 17 deletions .github/workflows/tag-and-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish UDS Package Jenkins
name: Publish UDS Package Jira

on:
push:
Expand All @@ -15,7 +15,7 @@ jobs:
steps:
- name: Create release tag
id: tag
uses: google-github-actions/release-please-action@v4.0.2
uses: google-github-actions/release-please-action@a37ac6e4f6449ce8b3f7607e4d97d0146028dc0b # v4.1.0
- id: release-flag
run: echo "release_created=${{ steps.tag.outputs.release_created || false }}" >> $GITHUB_OUTPUT

Expand All @@ -24,30 +24,29 @@ jobs:
if: ${{ needs.tag-new-version.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
name: Publish package
strategy:
matrix:
flavor: [registry1]

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Environment setup
uses: ./.github/actions/setup
uses: defenseunicorns/uds-common/.github/actions/setup@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
download-init-package: false
install-k3d: false
install-node: false

- name: Iron Bank Login
run: zarf tools registry login -u "${{secrets.IRON_BANK_ROBOT_USERNAME}}" -p "${{secrets.IRON_BANK_ROBOT_PASSWORD}}" registry1.dso.mil

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Package
run: uds run -f tasks/publish.yaml package --set FLAVOR=${{ matrix.flavor }}

- name: Save logs
if: always()
uses: defenseunicorns/uds-common/.github/actions/save-logs@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
suffix: '${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}'
77 changes: 45 additions & 32 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,65 @@
name: Test package
name: Test

# This workflow is triggered on pull requests to the main branch.
on:
# Manual trigger
workflow_dispatch:

# Triggered by pull-request-conditionals.yaml
workflow_call:
pull_request:
branches: [main]
types: [milestoned, opened, synchronize]
paths-ignore:
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"
- ".gitignore"
- "renovate.json"
- ".release-please-config.json"
- "release-please-config.json"
- "oscal-component.yaml"
- "CODEOWNERS"
- "LICENSE"
- "CONTRIBUTING.md"
- "SECURITY.md"

# Abort prior jobs in the same workflow / PR
concurrency:
group: test-${{ github.ref }}-${{ inputs.package }}
group: test-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
runs-on: "ubuntu-latest"
timeout-minutes: 20
name: Test
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
runs-on: uds-ubuntu-big-boy-8-core
timeout-minutes: 25
strategy:
matrix:
flavor: [registry1]
type: [install, upgrade]

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

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

- name: Iron Bank Login
run: zarf tools registry login -u "${{secrets.IRON_BANK_ROBOT_USERNAME}}" -p "${{secrets.IRON_BANK_ROBOT_PASSWORD}}" registry1.dso.mil

- name: Create test bundle
run: uds run create-test-bundle --set FLAVOR=${{ matrix.flavor }}

- name: Setup cluster
run: uds run setup-cluster
uses: defenseunicorns/uds-common/.github/actions/setup@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy test bundle
run: uds run deploy-test-bundle

- name: Test package
run: uds run test-package

- name: Cleanup
if: always()
run: uds run cleanup
- name: Test
uses: defenseunicorns/uds-common/.github/actions/test@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}

- name: Save logs
if: always()
uses: ./.github/actions/save-logs
uses: defenseunicorns/uds-common/.github/actions/save-logs@b2e8b25930c953ef893e7c787fe350f0d8679ee2 # v0.4.2
with:
suffix: ${{ matrix.type }}-${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}
Loading

0 comments on commit ff9ed06

Please sign in to comment.