Skip to content

Commit

Permalink
chore: change to use uds-common test action (#55)
Browse files Browse the repository at this point in the history
* update to use uds-common pr workflow and refactor to match other packages

* update task name so common action can find it

* fixing the names

* adding tasks needed by ci actions

* aligning task names to ci steps

* comment

* updates from pr comments

* fix permissions to call uds-common

* fixed job name
  • Loading branch information
ericwyles authored Mar 12, 2024
1 parent 2d44ae7 commit b0f4906
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 94 deletions.
30 changes: 3 additions & 27 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,7 @@ on:
branches: [main]
types: [milestoned, opened, edited, synchronize]

permissions:
contents: read

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@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2

- name: Install commitlint
run: |
npm install --save-dev @commitlint/config-conventional@19.0.3
npm install --save-dev @commitlint/cli@19.0.3
- name: Lint PR title
env:
pull_request_title: ${{ github.event.pull_request.title }}
run: echo "$pull_request_title" | npx commitlint
validate:
name: Validate
uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@442bae718050ea9a47254851a45632aabeb13b17
38 changes: 0 additions & 38 deletions .github/workflows/publish-uds-package.yaml

This file was deleted.

45 changes: 38 additions & 7 deletions .github/workflows/tag-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,52 @@ permissions:

jobs:
tag-new-version:
name: Tag New Version
permissions: write-all
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release-flag.outputs.release_created }}
steps:
- name: Create Release Tag
- name: Create release tag
id: tag
uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4.0.2
with:
command: manifest # use configs in release-please-config.json
- id: release-flag
run: echo "release_created=${{ steps.tag.outputs.release_created || false }}" >> $GITHUB_OUTPUT

publish-uds-package:
publish-package:
needs: tag-new-version
if: ${{ needs.tag-new-version.outputs.release_created == 'true'}}
uses: ./.github/workflows/publish-uds-package.yaml
secrets: inherit
if: ${{ needs.tag-new-version.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
name: Publish ${{ matrix.flavor }}
strategy:
matrix:
flavor: [upstream, registry1]

permissions:
contents: read
packages: write

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

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@442bae718050ea9a47254851a45632aabeb13b17
with:
username: ${{secrets.IRON_BANK_ROBOT_USERNAME}}
password: ${{secrets.IRON_BANK_ROBOT_PASSWORD}}

- name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
registry: ghcr.io
username: dummy
password: ${{ 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@442bae718050ea9a47254851a45632aabeb13b17
with:
suffix: ${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}
50 changes: 30 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@ name: Test package

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]
branches: [main]
types: [milestoned, opened, edited, 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:
Expand All @@ -15,36 +32,29 @@ permissions:

jobs:
test:
name: Create and Deploy Flavor ${{ matrix.flavor }}
runs-on: "uds-ubuntu-big-boy-16-core"
name: Test
strategy:
matrix:
flavor: [upstream, registry1]

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

- name: Environment setup
uses: ./.github/actions/setup
uses: defenseunicorns/uds-common/.github/actions/setup@442bae718050ea9a47254851a45632aabeb13b17
with:
username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}

- name: Standup k3d Cluster and UDS Package Gitlab and Deploy UDS Gitlab Runner
run: uds run default --set FLAVOR=${{ matrix.flavor }}

- name: Run Health Check Tests for Gitlab and Gitlab Runner
run: uds run test-package
username: ${{secrets.IRON_BANK_ROBOT_USERNAME}}
password: ${{secrets.IRON_BANK_ROBOT_PASSWORD}}

- name: Cleanup the k3d Cluster
if: always()
run: uds run cleanup-cluster
- name: Test
uses: defenseunicorns/uds-common/.github/actions/test@442bae718050ea9a47254851a45632aabeb13b17
with:
flavor: ${{ matrix.flavor }}

- name: Save logs
if: always()
uses: defenseunicorns/uds-common/.github/actions/save-logs@c20015729cd02b33993565fa927b4b34e2ac5a37
uses: defenseunicorns/uds-common/.github/actions/save-logs@442bae718050ea9a47254851a45632aabeb13b17
with:
suffix: '${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}'
suffix: ${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}
28 changes: 26 additions & 2 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ tasks:
- name: default
description: Setup k3d cluster, deploy Gitlab, deploy Gitlab runner
actions:
- task: gitlab
- task: gitlab-runner
- task: create-test-bundle

- name: create-package
description: Create the Gitlab runner package
Expand Down Expand Up @@ -46,3 +45,28 @@ tasks:
description: Delete the k3d cluster
actions:
- cmd: k3d cluster delete uds

# CI will execute the following (via uds-common/.github/actions/test) so they need to be here with these names

- name: create-test-bundle
description: Setup k3d cluster, deploy Gitlab, deploy Gitlab runner
actions:
- task: create:gitlab-bundle
- task: package:package

- name: setup-cluster
description: setup the test cluster
actions:
- task: setup:k3d-test-cluster

- name: deploy-test-bundle
description: deploy the test bundle
actions:
- task: deploy:gitlab-bundle
- task: deploy:gitlab-runner-package

- name: test-package
description: Test the health of Gitlab and Gitlab Runner deployments
actions:
- task: test:gl-health-check
- task: test:glr-health-check

0 comments on commit b0f4906

Please sign in to comment.