Skip to content

Commit a621eaa

Browse files
authored
chore: Add yamllint (#1528)
This commit adds yamllint. A YAML linter that is designed to keep our YAML consistently formatted and to ensure we avoid common syntax errors. Signed-off-by: Dave Tucker <[email protected]>
1 parent 95dce23 commit a621eaa

File tree

76 files changed

+808
-787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+808
-787
lines changed

.github/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ changelog:
22
categories:
33
- title: 🏕 Features
44
labels:
5-
- '^feat.*'
5+
- ^feat.*
66
- title: 🧑‍💻 Dev
77
labels:
8-
- '^dev.*'
8+
- ^dev.*
99
- title: 🔧 Fix
1010
labels:
11-
- '^fix.*'
11+
- ^fix.*
1212
- title: 👒 Chores
1313
labels:
14-
- '^chore.*'
14+
- ^chore.*
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: baseimage_dispatch
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_dispatch:
55

66
jobs:
@@ -9,5 +9,5 @@ jobs:
99
with:
1010
pushImage: true
1111
secrets:
12-
username: ${{ secrets.BOT_NAME }}
13-
password: ${{ secrets.BOT_TOKEN }}
12+
username: ${{ secrets.BOT_NAME }}
13+
password: ${{ secrets.BOT_TOKEN }}

.github/workflows/c.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: c
22
# for c basic checks - it builds and is correctly formatted
3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_call:
55

66
permissions:
@@ -14,7 +14,7 @@ jobs:
1414
- uses: jidicula/[email protected]
1515
with:
1616
clang-format-version: "17"
17-
check-path: "bpfassets/libbpf/src"
17+
check-path: bpfassets/libbpf/src
1818

1919
build:
2020
runs-on: ubuntu-latest

.github/workflows/commitMsg.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Commit Message Check'
2-
on:
1+
name: Commit Message Check
2+
on: # yamllint disable-line rule:truthy
33
pull_request:
44
types:
55
- opened
@@ -21,21 +21,21 @@ jobs:
2121
- name: Try to keep the subject line to 50 characters or less; do not exceed 72 characters
2222
uses: gsactions/commit-message-checker@v2
2323
with:
24-
pattern: '^[^#].{72}'
25-
error: 'The maximum line length of 72 characters is exceeded.'
26-
excludeDescription: 'true' # optional: this excludes the description body of a pull request
27-
excludeTitle: 'true' # optional: this excludes the title of a pull request
24+
pattern: ^[^#].{72}
25+
error: The maximum line length of 72 characters is exceeded.
26+
excludeDescription: "true" # optional: this excludes the description body of a pull request
27+
excludeTitle: "true" # optional: this excludes the title of a pull request
2828
- name: Providing additional context if I am right means formatting in topic":" something
2929
uses: gsactions/commit-message-checker@v2
3030
with:
31-
pattern: '^.*:\s.*'
32-
error: 'topic: someting for example commit msg as [CI: enhancement xxx]'
33-
excludeDescription: 'true' # optional: this excludes the description body of a pull request
34-
excludeTitle: 'true' # optional: this excludes the title of a pull request
31+
pattern: ^.*:\s.*
32+
error: "topic: someting for example commit msg as [CI: enhancement xxx]"
33+
excludeDescription: "true" # optional: this excludes the description body of a pull request
34+
excludeTitle: "true" # optional: this excludes the title of a pull request
3535
- name: The first word in the commit message subject should be capitalized unless it starts with a lowercase symbol or other identifier
3636
uses: gsactions/commit-message-checker@v2
3737
with:
38-
pattern: '^[^].*'
39-
error: 'topic: someting for example commit msg as [CI: enhancement xxx]'
40-
excludeDescription: 'true' # optional: this excludes the description body of a pull request
41-
excludeTitle: 'true' # optional: this excludes the title of a pull request
38+
pattern: ^[^].*
39+
error: "topic: someting for example commit msg as [CI: enhancement xxx]"
40+
excludeDescription: "true" # optional: this excludes the description body of a pull request
41+
excludeTitle: "true" # optional: this excludes the title of a pull request

.github/workflows/daily.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This workflow would be run on sustainable-computing-io/kepler only.
22
name: Scheduled build
3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_dispatch:
55
branch_protection_rule:
66
schedule:
7-
- cron: "12 9 * * *"
7+
- cron: 12 9 * * *
88

99
jobs:
1010
# daily go security
@@ -16,14 +16,14 @@ jobs:
1616
if: github.repository == 'sustainable-computing-io/kepler'
1717
uses: ./.github/workflows/image_base.yml
1818
secrets:
19-
username: ${{ secrets.BOT_NAME }}
20-
password: ${{ secrets.BOT_TOKEN }}
19+
username: ${{ secrets.BOT_NAME }}
20+
password: ${{ secrets.BOT_TOKEN }}
2121
image:
2222
needs: [image_base]
2323
uses: ./.github/workflows/image.yml
2424
secrets:
25-
username: ${{ secrets.BOT_NAME }}
26-
password: ${{ secrets.BOT_TOKEN }}
25+
username: ${{ secrets.BOT_NAME }}
26+
password: ${{ secrets.BOT_TOKEN }}
2727
# daily openSSF scan
2828
scorecard:
2929
if: github.repository == 'sustainable-computing-io/kepler'

.github/workflows/developer_local.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
name: local dev env validation
22
# for developer local environment script or test usage
3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_call:
55

66
jobs:
77
unit_test_mac:
88
runs-on: macos-latest
99
steps:
10-
- uses: actions/[email protected]
11-
with:
12-
persist-credentials: false
13-
fetch-depth: 0
14-
- uses: actions/setup-go@v5
15-
with:
16-
go-version-file: go.mod
17-
- name: Prepare environment
18-
run: |
10+
- uses: actions/[email protected]
11+
with:
12+
persist-credentials: false
13+
fetch-depth: 0
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version-file: go.mod
17+
- name: Prepare environment
18+
run: |
1919
brew install cpuid
2020
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
2121
git config --global --add safe.directory /kepler
22-
- name: Run
23-
run: make test-mac-verbose
22+
- name: Run
23+
run: make test-mac-verbose
2424

2525
local_env:
2626
runs-on: ubuntu-latest

.github/workflows/equinix_metal_flow.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Equinix Metal Action
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_dispatch:
55

66
jobs:
77
Create-runner:
8-
name: "Create Runner"
8+
name: Create Runner
99
runs-on: ubuntu-latest
1010

1111
steps:
@@ -15,12 +15,12 @@ jobs:
1515
github_token: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
1616
metal_auth_token: ${{ secrets.EQUINIX_API_TOKEN }}
1717
metal_project_id: ${{ secrets.EQUINIX_PROJECT_ID }}
18-
metro: "da"
19-
plan: "c3.small.x86"
20-
os: "rhel_9"
18+
metro: da
19+
plan: c3.small.x86
20+
os: rhel_9
2121

2222
Install:
23-
name: "Install"
23+
name: Install
2424
needs: Create-runner
2525
runs-on: self-hosted
2626
continue-on-error: true
@@ -136,7 +136,7 @@ jobs:
136136
curl "http://localhost:44322/metrics?names=openmetrics.kepler.kepler_node_package_joules_total"
137137
138138
Cleanup:
139-
name: "Cleanup"
139+
name: Cleanup
140140
runs-on: ubuntu-latest
141141
needs: [Install]
142142

.github/workflows/golang.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: golang
22
# for golang basic checks with go command line tool
3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_call:
55

66
permissions:

.github/workflows/gosec.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ name: Security Scan
22

33
# Run workflow each time code is pushed to your repository and on a schedule.
44
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
5-
on:
5+
on: # yamllint disable-line rule:truthy
66
workflow_call:
77

88
jobs:
99
tests:
1010
runs-on: ubuntu-latest
1111
env:
12-
GO111MODULE: on
12+
GO111MODULE: "on"
1313
steps:
1414
- name: Checkout Source
1515
uses: actions/[email protected]
@@ -18,7 +18,7 @@ jobs:
1818
uses: securego/gosec@master
1919
with:
2020
# Arguments for gosec, -no-fail to not fail the workflow based on findings
21-
args: '-no-fail -fmt sarif -out gosec-results.sarif ./...'
21+
args: -no-fail -fmt sarif -out gosec-results.sarif ./...
2222

2323
- name: Upload SARIF file
2424
uses: github/codeql-action/upload-sarif@v3

.github/workflows/image.yml

+59-59
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: image
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_call:
55
inputs:
66
imageTag:
7-
default: 'latest'
7+
default: latest
88
type: string
99
pushImage:
1010
default: true
@@ -22,55 +22,55 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
include:
25-
- IMAGE_NAME: kepler
26-
IMAGE_FILE: build/Dockerfile
27-
PLATFORMS: linux/amd64,linux/arm64
28-
BUILD_ARGS: |
29-
INSTALL_DCGM=false
30-
INSTALL_HABANA=false
31-
VERSION=${{ inputs.imageTag }}
32-
LABEL: ${{ inputs.imageTag }}
33-
- IMAGE_NAME: kepler
34-
IMAGE_FILE: build/Dockerfile
35-
PLATFORMS: linux/amd64
36-
BUILD_ARGS: |
37-
INSTALL_DCGM=true
38-
INSTALL_HABANA=false
39-
VERSION=${{ inputs.imageTag }}-dcgm
40-
LABEL: ${{ inputs.imageTag }}-dcgm
41-
- IMAGE_NAME: kepler
42-
IMAGE_FILE: build/Dockerfile
43-
PLATFORMS: linux/amd64
44-
BUILD_ARGS: |
45-
INSTALL_DCGM=false
46-
INSTALL_HABANA=true
47-
VERSION=${{ inputs.imageTag }}-habana
48-
LABEL: ${{ inputs.imageTag }}-habana
49-
- IMAGE_NAME: kepler-validator
50-
IMAGE_FILE: build/Dockerfile.kepler-validator
51-
BUILD_ARGS: ""
52-
PLATFORMS: linux/amd64
53-
LABEL: ${{ inputs.imageTag }}
25+
- IMAGE_NAME: kepler
26+
IMAGE_FILE: build/Dockerfile
27+
PLATFORMS: linux/amd64,linux/arm64
28+
BUILD_ARGS: |
29+
INSTALL_DCGM=false
30+
INSTALL_HABANA=false
31+
VERSION=${{ inputs.imageTag }}
32+
LABEL: ${{ inputs.imageTag }}
33+
- IMAGE_NAME: kepler
34+
IMAGE_FILE: build/Dockerfile
35+
PLATFORMS: linux/amd64
36+
BUILD_ARGS: |
37+
INSTALL_DCGM=true
38+
INSTALL_HABANA=false
39+
VERSION=${{ inputs.imageTag }}-dcgm
40+
LABEL: ${{ inputs.imageTag }}-dcgm
41+
- IMAGE_NAME: kepler
42+
IMAGE_FILE: build/Dockerfile
43+
PLATFORMS: linux/amd64
44+
BUILD_ARGS: |
45+
INSTALL_DCGM=false
46+
INSTALL_HABANA=true
47+
VERSION=${{ inputs.imageTag }}-habana
48+
LABEL: ${{ inputs.imageTag }}-habana
49+
- IMAGE_NAME: kepler-validator
50+
IMAGE_FILE: build/Dockerfile.kepler-validator
51+
BUILD_ARGS: ""
52+
PLATFORMS: linux/amd64
53+
LABEL: ${{ inputs.imageTag }}
5454
steps:
55-
- name: Checkout
56-
uses: actions/[email protected]
57-
- name: Set up QEMU
58-
uses: docker/setup-qemu-action@v3
59-
with:
60-
image: tonistiigi/binfmt:qemu-v8.1.5
61-
- name: Set up Docker Buildx
62-
uses: docker/setup-buildx-action@v3
63-
- name: Login to Quay
64-
if: ${{ inputs.pushImage }}
65-
uses: docker/login-action@v3
66-
with:
67-
registry: quay.io/sustainable_computing_io
68-
username: ${{ secrets.username }}
69-
password: ${{ secrets.password }}
55+
- name: Checkout
56+
uses: actions/[email protected]
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
with:
60+
image: tonistiigi/binfmt:qemu-v8.1.5
61+
- name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v3
63+
- name: Login to Quay
64+
if: ${{ inputs.pushImage }}
65+
uses: docker/login-action@v3
66+
with:
67+
registry: quay.io/sustainable_computing_io
68+
username: ${{ secrets.username }}
69+
password: ${{ secrets.password }}
7070

71-
- name: Build and push image
72-
uses: docker/build-push-action@v5
73-
with:
71+
- name: Build and push image
72+
uses: docker/build-push-action@v5
73+
with:
7474
context: .
7575
platforms: ${{matrix.PLATFORMS}}
7676
push: ${{ inputs.pushImage }}
@@ -79,17 +79,17 @@ jobs:
7979
labels: ${{matrix.LABEL}}
8080
file: ${{matrix.IMAGE_FILE}}
8181

82-
- name: Generate SBOM
83-
uses: anchore/[email protected]
84-
with:
85-
image: quay.io/sustainable_computing_io/${{matrix.IMAGE_NAME}}:${{matrix.LABEL}}
86-
artifact-name: sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.json
87-
output-file: ./sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
82+
- name: Generate SBOM
83+
uses: anchore/[email protected]
84+
with:
85+
image: quay.io/sustainable_computing_io/${{matrix.IMAGE_NAME}}:${{matrix.LABEL}}
86+
artifact-name: sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.json
87+
output-file: ./sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
8888

89-
- name: save Kepler image SBOM as artifact
90-
if: ${{ inputs.pushImage }}
91-
uses: actions/[email protected]
92-
with:
89+
- name: save Kepler image SBOM as artifact
90+
if: ${{ inputs.pushImage }}
91+
uses: actions/[email protected]
92+
with:
9393
name: sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
9494
path: ./sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
9595
retention-days: 1

0 commit comments

Comments
 (0)