Skip to content

Commit

Permalink
Merge pull request #1284 from aFlyBird0/feat-yaml-lint
Browse files Browse the repository at this point in the history
ci: yaml lint
  • Loading branch information
daniel-hutao authored Dec 2, 2022
2 parents 3f8a33d + d365f04 commit b7d1842
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 11 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/lint-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Yaml Lint

on:
pull_request:
branches: [ main ]
paths:
- '**.yaml'
- '**.yml'

jobs:
yamlLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Remove All Strings In Square Brackets
run: |
# remove strings in "[[]]" in .yml or .yaml files, or yaml lint will fail
sed -i "s/\[\[.*\]\]//g" `grep "\[\[.*\]\]" -rl --include="*.yml" --include="*.yaml" .`
- name: Yaml Lint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: .
config_file: .yamllint.yml
34 changes: 34 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
extends: default
rules:
brackets: disable # do not check brackets
comments:
require-starting-space: true
min-spaces-from-content: 1 # at leaset 1 space between comment and content
document-start: disable # whether the document must start with '---' is optional
indentation:
spaces: 2
# block sequences should not be indented
# e.g.:
# OK:
# key:
# - value1
# - value2
# NOT OK:
# key:
# - value1
# - value2
indent-sequences: false
line-length: disable
new-line-at-end-of-file: enable # must have a new line at the end of file
trailing-spaces: disable # do not check trailing spaces
truthy: disable # do not check truthy
ignore: |
*.tpl.yaml
*.tpl.yml
*tmpl.yaml
*tmpl.yml
*template.yml
*template.yaml
**/.github/**
**/githubactions/**
**/workflows/**
12 changes: 6 additions & 6 deletions hack/e2e/kind.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 8080
hostPort: 8080
listenAddress: "0.0.0.0"
protocol: tcp
- role: control-plane
extraPortMappings:
- containerPort: 8080
hostPort: 8080
listenAddress: "0.0.0.0"
protocol: tcp
2 changes: 1 addition & 1 deletion internal/pkg/show/config/plugins/ci-generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tools:
# options for the plugin
options:
ci:
configLocation : Jenkinsfile
configLocation: Jenkinsfile
# support jenkins/gitlab/github for now
type: jenkins
projectRepo:
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/show/config/plugins/gitlabci-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ tools:
tags: "YOUR_GITLAB_RUNNER_TAG"
# Package step will run on the specified branchs, default use "main"
allowedBranch:
- "main"
- "test"
# Customized pipeline scripts. Leave it blank to use default value.
- "main"
- "test"
# Customized pipeline scripts. Leave it blank to use default value.
scriptCommand:
- "YOUR_PACKAGE_SCRIPTS"
- "YOUR_PACKAGE_SCRIPTS"
build:
# Same as above
baseOption:
Expand Down

0 comments on commit b7d1842

Please sign in to comment.