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

feat: updating workflows and tasks to latest varsion #48

Merged
merged 12 commits into from
Nov 1, 2024
21 changes: 11 additions & 10 deletions .github/workflows/ci-docs-shim.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: CI Docs Shim

on:
Expand All @@ -6,15 +9,13 @@ on:
types: [milestoned, opened, synchronize]

jobs:
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
runs-on: "ubuntu-latest"
timeout-minutes: 20
validate:
strategy:
matrix:
flavor: [registry1]
type: [install]
steps:
- name: Shim for ${{ matrix.type }} ${{ matrix.flavor }}
run: |
echo "Documentation-only change detected; marking ${{ matrix.type }} ${{ matrix.flavor }} as successful."
type: [install, upgrade]
flavor: [upstream, registry1]
uses: defenseunicorns/uds-common/.github/workflows/callable-ci-docs-shim.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
with:
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}
secrets: inherit # Inherits all secrets from the parent workflow.
10 changes: 4 additions & 6 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Metadata

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

# This allows other repositories to call this workflow in a reusable way
workflow_call:

jobs:
validate:
name: Validate
uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@76287d41ec5f06ecbdd0a6453877a78675aceffe # v0.11.2
uses: defenseunicorns/uds-common/.github/workflows/callable-commitlint.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
34 changes: 7 additions & 27 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Scan

on:
# This workflow is triggered on pull requests to the main branch.
pull_request:
branches: [main]
types: [milestoned, opened, synchronize]
# 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]

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

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@76287d41ec5f06ecbdd0a6453877a78675aceffe # v0.11.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
uses: defenseunicorns/uds-common/.github/workflows/callable-lint.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
secrets: inherit
3 changes: 3 additions & 0 deletions .github/workflows/pull-request-conditionals.yaml
Michael-Kruggel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Setup

# This workflow is triggered on pull requests to the main branch.
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Release

on:
push:
branches:
- main

# Permissions for the GITHUB_TOKEN used by the workflow.
permissions:
contents: read # Allows reading the content of the repository.
packages: read # Allows reading the content of the repository's packages.
id-token: write

jobs:
tag-new-version:
permissions: write-all
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release-flag.outputs.release_created }}
steps:
- name: Create Release Tag
id: tag
uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
- id: release-flag
run: echo "release_created=${{ steps.tag.outputs.release_created || false }}" >> "$GITHUB_OUTPUT"

publish:
permissions:
contents: read # Allows reading the content of the repository.
packages: write # Allows reading the content of the repository's packages.
id-token: write
needs: tag-new-version
if: ${{ needs.tag-new-version.outputs.release_created == 'true' }}
strategy:
matrix:
flavor: [upstream, registry1]
architecture: [amd64]
uses: defenseunicorns/uds-common/.github/workflows/callable-publish.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
with:
flavor: ${{ matrix.flavor }}
runsOn: uds-marketplace-ubuntu-big-boy-8-core
secrets: inherit # Inherits all secrets from the parent workflow.
38 changes: 6 additions & 32 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Scorecards supply-chain security
on:
# Only the default branch is supported.
Expand All @@ -11,40 +14,11 @@ on:
permissions: read-all

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
validate:
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
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@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
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@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
with:
sarif_file: results.sarif
uses: defenseunicorns/uds-common/.github/workflows/callable-scorecard.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
secrets: inherit
52 changes: 0 additions & 52 deletions .github/workflows/tag-and-release.yaml

This file was deleted.

82 changes: 27 additions & 55 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: Test

# This workflow is triggered on pull requests to the main branch.
Expand Down Expand Up @@ -30,65 +33,34 @@ concurrency:

permissions:
contents: read
id-token: write
packages: read

jobs:
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
check-flavor:
runs-on: uds-marketplace-ubuntu-big-boy-8-core
timeout-minutes: 25
strategy:
matrix:
flavor: [registry1]
type: [install]
# Cannot test upgrade without a license key
# type: [install, upgrade]

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

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

- name: Playwright setup
uses: defenseunicorns/uds-common/.github/actions/playwright@76287d41ec5f06ecbdd0a6453877a78675aceffe # v0.11.2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Test
uses: defenseunicorns/uds-common/.github/actions/test@76287d41ec5f06ecbdd0a6453877a78675aceffe # v0.11.2
with:
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}
- name: test-flavor
uses: defenseunicorns/uds-common/.github/actions/test-flavor@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
id: test-flavor
outputs:
upgrade-flavors: ${{ steps.test-flavor.outputs.upgrade-flavors }}

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

- name: Print cluster info
if: always()
shell: bash -e -o pipefail {0}
run: |
kubectl get nodes -o wide

- name: Print pod info
if: always()
shell: bash -e -o pipefail {0}
run: |
kubectl get pods -A -o wide

- name: Print service info
if: always()
shell: bash -e -o pipefail {0}
run: |
kubectl get svc -A -o wide

- name: Print events
if: always()
shell: bash -e -o pipefail {0}
run: |
kubectl get events -A -o wide
validate:
needs: check-flavor
strategy:
fail-fast: false
matrix:
type: [install, upgrade]
flavor: [upstream, registry1]
uses: defenseunicorns/uds-common/.github/workflows/callable-test.yaml@d59b1c601730bfa7ab76439643242358e529603e # v1.2.2
with:
runsOn: uds-marketplace-ubuntu-big-boy-8-core
upgrade-flavors: ${{ needs.check-flavor.outputs.upgrade-flavors }}
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}
reports-path: "tests/.playwright/reports/"
secrets: inherit # Inherits all secrets from the parent workflow.
Loading