Skip to content

Commit b7d1842

Browse files
authored
Merge pull request #1284 from aFlyBird0/feat-yaml-lint
ci: yaml lint
2 parents 3f8a33d + d365f04 commit b7d1842

File tree

5 files changed

+68
-11
lines changed

5 files changed

+68
-11
lines changed

.github/workflows/lint-yaml.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Yaml Lint
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- '**.yaml'
8+
- '**.yml'
9+
10+
jobs:
11+
yamlLint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Remove All Strings In Square Brackets
16+
run: |
17+
# remove strings in "[[]]" in .yml or .yaml files, or yaml lint will fail
18+
sed -i "s/\[\[.*\]\]//g" `grep "\[\[.*\]\]" -rl --include="*.yml" --include="*.yaml" .`
19+
- name: Yaml Lint
20+
uses: ibiqlik/action-yamllint@v3
21+
with:
22+
file_or_dir: .
23+
config_file: .yamllint.yml

.yamllint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extends: default
2+
rules:
3+
brackets: disable # do not check brackets
4+
comments:
5+
require-starting-space: true
6+
min-spaces-from-content: 1 # at leaset 1 space between comment and content
7+
document-start: disable # whether the document must start with '---' is optional
8+
indentation:
9+
spaces: 2
10+
# block sequences should not be indented
11+
# e.g.:
12+
# OK:
13+
# key:
14+
# - value1
15+
# - value2
16+
# NOT OK:
17+
# key:
18+
# - value1
19+
# - value2
20+
indent-sequences: false
21+
line-length: disable
22+
new-line-at-end-of-file: enable # must have a new line at the end of file
23+
trailing-spaces: disable # do not check trailing spaces
24+
truthy: disable # do not check truthy
25+
ignore: |
26+
*.tpl.yaml
27+
*.tpl.yml
28+
*tmpl.yaml
29+
*tmpl.yml
30+
*template.yml
31+
*template.yaml
32+
**/.github/**
33+
**/githubactions/**
34+
**/workflows/**

hack/e2e/kind.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
kind: Cluster
22
apiVersion: kind.x-k8s.io/v1alpha4
33
nodes:
4-
- role: control-plane
5-
extraPortMappings:
6-
- containerPort: 8080
7-
hostPort: 8080
8-
listenAddress: "0.0.0.0"
9-
protocol: tcp
4+
- role: control-plane
5+
extraPortMappings:
6+
- containerPort: 8080
7+
hostPort: 8080
8+
listenAddress: "0.0.0.0"
9+
protocol: tcp

internal/pkg/show/config/plugins/ci-generic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tools:
88
# options for the plugin
99
options:
1010
ci:
11-
configLocation : Jenkinsfile
11+
configLocation: Jenkinsfile
1212
# support jenkins/gitlab/github for now
1313
type: jenkins
1414
projectRepo:

internal/pkg/show/config/plugins/gitlabci-java.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ tools:
2323
tags: "YOUR_GITLAB_RUNNER_TAG"
2424
# Package step will run on the specified branchs, default use "main"
2525
allowedBranch:
26-
- "main"
27-
- "test"
28-
# Customized pipeline scripts. Leave it blank to use default value.
26+
- "main"
27+
- "test"
28+
# Customized pipeline scripts. Leave it blank to use default value.
2929
scriptCommand:
30-
- "YOUR_PACKAGE_SCRIPTS"
30+
- "YOUR_PACKAGE_SCRIPTS"
3131
build:
3232
# Same as above
3333
baseOption:

0 commit comments

Comments
 (0)