Skip to content

Commit

Permalink
Add yamllint check and fix warning
Browse files Browse the repository at this point in the history
This will enable the yamllint lint check in CI
and fix all the yamllint warnings
  • Loading branch information
piyush-garg committed Aug 14, 2020
1 parent 8f58604 commit 293c860
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 22 deletions.
1 change: 0 additions & 1 deletion config/201-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ roleRef:
kind: ClusterRole
name: tekton-pipelines-leader-election
apiGroup: rbac.authorization.k8s.io

22 changes: 11 additions & 11 deletions config/config-artifact-bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ metadata:
labels:
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
# data:
# # location of the gcs bucket to be used for artifact storage
# location: "gs://bucket-name"
# # name of the secret that will contain the credentials for the service account
# # with access to the bucket
# bucket.service.account.secret.name:
# # The key in the secret with the required service account json
# bucket.service.account.secret.key:
# # The field name that should be used for the service account
# # Valid values: GOOGLE_APPLICATION_CREDENTIALS, BOTO_CONFIG.
# bucket.service.account.field.name: GOOGLE_APPLICATION_CREDENTIALS
# data:
# # location of the gcs bucket to be used for artifact storage
# location: "gs://bucket-name"
# # name of the secret that will contain the credentials for the service account
# # with access to the bucket
# bucket.service.account.secret.name:
# # The key in the secret with the required service account json
# bucket.service.account.secret.key:
# # The field name that should be used for the service account
# # Valid values: GOOGLE_APPLICATION_CREDENTIALS, BOTO_CONFIG.
# bucket.service.account.field.name: GOOGLE_APPLICATION_CREDENTIALS
2 changes: 1 addition & 1 deletion config/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data:
# TaskRun specific sink, so the default is the only option available.
# If no sink is specified, no CloudEvent is generated
# default-cloud-events-sink:
# default-task-run-workspace-binding contains the default workspace
# configuration provided for any Workspaces that a Task declares
# but that a TaskRun does not explicitly provide.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ spec:
value: "100"
- name: pl-param-y
value: "200"
- name: pl-param-z # the extra parameter
# the extra parameter
- name: pl-param-z
value: "300"
pipelineRef:
name: pipeline-with-extra-params
2 changes: 1 addition & 1 deletion examples/v1beta1/pipelineruns/using_context_variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
- name: pipeline-uid
value: "$(context.pipelineRun.uid)"
- name: pipeline-name
value: "$(context.pipeline.name)"
value: "$(context.pipeline.name)"
- name: pipelineRun-name
value: "$(context.pipelineRun.name)"
taskSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ metadata:
annotations:
tekton.dev/git-0: localhost
data:
ssh-privatekey: SGVsbG8sIHdvcmxkCg== # "Hello, world!"
known_hosts: SGVsbG8sIHdvcmxkCg== # "Hello, world!"
# "Hello, world!"
ssh-privatekey: SGVsbG8sIHdvcmxkCg==
# "Hello, world!"
known_hosts: SGVsbG8sIHdvcmxkCg==
---
apiVersion: v1
kind: ServiceAccount
Expand Down
4 changes: 2 additions & 2 deletions examples/v1beta1/taskruns/run-steps-as-non-root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
name: show-non-root-steps
spec:
steps:
# no securityContext specified so will use
# no securityContext specified so will use
# securityContext from TaskRun podTemplate
- name: show-user-1001
image: ubuntu
command:
- ps
args:
- "aux"
# securityContext specified so will run as
# securityContext specified so will run as
# user 2000 instead of 1001
- name: show-user-2000
image: ubuntu
Expand Down
33 changes: 30 additions & 3 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,37 @@ export DISABLE_YAML_LINTING=1

source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh

function check_go_lint() {
header "Testing if golint has been done"

# deadline of 5m, and show all the issues
golangci-lint -j 1 --color=never run

if [[ $? != 0 ]]; then
results_banner "Go Lint" 1
exit 1
fi

results_banner "Go Lint" 0
}

function check_yaml_lint() {
header "Testing if yamllint has been done"

local YAML_FILES=$(find . -type f -regex ".*y[a]ml" -print)
yamllint -c .yamllint ${YAML_FILES}

if [[ $? != 0 ]]; then
results_banner "YAML Lint" 1
exit 1
fi

results_banner "YAML Lint" 0
}

function post_build_tests() {
header "running golangci-lint"
# deadline of 5m, and show all the issues
golangci-lint -j 1 --color=never run
check_go_lint
check_yaml_lint
}

# We use the default build, unit and integration test runners.
Expand Down

0 comments on commit 293c860

Please sign in to comment.