diff --git a/task/catlin-validate/0.1/README.md b/task/catlin-validate/0.1/README.md index 1062bdf599..efb8e685bb 100644 --- a/task/catlin-validate/0.1/README.md +++ b/task/catlin-validate/0.1/README.md @@ -12,7 +12,7 @@ * Without downloading catlin or having any knowledge on how to run catlin you can check if your task passes all catlin checks by simply running a taskrun * A working taskrun is provided in the [tests](../0.1/tests/taskrun-success.yaml) folder. * [This](../0.1/tests/taskrun-success.yaml) taskrun validates a sample hello task. -* The hello task yaml which we want to validate is injected in the source workspace in the appropriate folder structure using [this](../0.1/tests/source-success-configmap.yaml) configMap. +* The hello task yaml which we want to validate is injected in the source workspace in the appropriate folder structure using [this](../0.1/tests/source-success-task-configmap.yaml) configMap. * The filepath of the hello.yaml is supplied as a catlin-input using [this](../0.1/tests/input-configmap.yaml) configMap * Thus without knowing anything about how to run catlin validate you can quickly lint your task yaml by simply following above steps @@ -43,7 +43,7 @@ Ignores any warnings in catlin output. If catlin output has only success and war ## Workspaces ### source -This workspace contains files on which catlin will be run. This can be the git repo of your tekton catalog. task yamls in this folder should have a path that follows tekton-catalog folder structure. Check [this](../0.1/tests/source-success-configmap.yaml) configmap and how it is injected into the cource workspace in [this](../0.1/tests/taskrun-success.yaml) taskrun as an example +This workspace contains files on which catlin will be run. This can be the git repo of your tekton catalog. task yamls in this folder should have a path that follows tekton-catalog folder structure. Check [this](../0.1/tests/source-success-task-configmap.yaml) configmap and how it is injected into the cource workspace in [this](../0.1/tests/taskrun-success.yaml) taskrun as an example ### catlin-input A workspace that contains [$(params.inputFile)](#inputfile) Check [this](../0.1/tests/input-configmap.yaml) configmap and how it is injected onto the catlin-input workspace in [this](../0.1/tests/taskrun-success.yaml) taskrun as an example ### catlin-output @@ -73,7 +73,7 @@ The Task can be run on `linux/amd64` platform. git clone https://github.com/tektoncd/catalog.git cd catalog/task/catlin-validate/0.1/tests kubectl apply -f input-configmap.yaml -kubectl apply -f source-success-configmap.yaml +kubectl apply -f source-success-task-configmap.yaml kubectl create -f taskrun-success.yaml kubectl logs catlin-run-pod ``` @@ -94,7 +94,7 @@ FILE: /workspace/source/task/hello/0.1/hello.yaml git clone https://github.com/tektoncd/catalog.git cd catalog/task/catlin-validate/0.1/tests kubectl apply -f input-configmap.yaml -kubectl apply -f source-warn-configmap.yaml +kubectl apply -f source-warn-task-configmap.yaml kubectl create -f taskrun-warn.yaml kubectl logs catlin-run-pod ``` @@ -114,9 +114,9 @@ WARN : Step "echo" uses image "$(params.image)" that contains variables; skippin * **Note** Error will result in [catlin-status](#catlin-status) having the value as failure. ``` git clone https://github.com/tektoncd/catalog.git -cd catalog/task/catlin-validate/0.1/tests +cd catalog/task/catlin-validate/0.1/samples kubectl apply -f input-configmap.yaml -kubectl apply -f source-error-configmap.yaml +kubectl apply -f source-error-task-configmap.yaml kubectl create -f taskrun-error.yaml kubectl logs catlin-run-pod ``` diff --git a/task/catlin-validate/0.1/catlin-validate.yaml b/task/catlin-validate/0.1/catlin-validate.yaml index 7a33b98dbc..30bfce4d4d 100644 --- a/task/catlin-validate/0.1/catlin-validate.yaml +++ b/task/catlin-validate/0.1/catlin-validate.yaml @@ -29,20 +29,20 @@ spec: task/git-clone/0.9/git-clone.yaml task/git-clone/0.1/git-comment.yaml it will run catlin on the above paths in the source workspace one after another and store its output in catlin-output workspace - final command run will be + final command run will be 'catlin validate $(workspaces.source.path)/task/git-clone/0.9/git-clone.yaml >> $(workspaces.catlin-output.path)/output.txt' 'catlin validate $(workspaces.source.path)/task/git-clone/0.1/git-comment.yaml >> $(workspaces.catlin-output.path)/output.txt' type: string - name: ignoreWarnings description: | - Ignores any warnings in catlin output. + Ignores any warnings in catlin output. If catlin output has only success and warnings, all warnings are ignored and final catlin output will be success type: string default: "false" results: - name: catlin-status description: | - final status of catlin command. If all catlin validate command succeeds status will be set to 'success', if any one command validate command fails + final status of catlin command. If all catlin validate command succeeds status will be set to 'success', if any one command validate command fails status will be set to 'failure', If there is no failure and atleast one catline validate command is warning the status will be set to 'warning' workspaces: - name: source @@ -87,7 +87,6 @@ spec: STR=$(cat "$CATLIN_OUTPUT_WORKSPACE_PATH"/"$OUTPUT_FILE") ERROR='ERROR' WARN='WARN' - if [[ "$IGNORE_WARNINGS" == "true" ]]; then echo "Ignore Warnings is set to true, any warnings in catlin output will be ignored" fi @@ -105,8 +104,4 @@ spec: echo "success" | tr -d "\n" > "$(results.catlin-status.path)" echo "" echo "Final output of catlin validate is success." - fi - - - - + fi \ No newline at end of file diff --git a/task/catlin-validate/0.1/samples/input-configmap.yaml b/task/catlin-validate/0.1/samples/input-configmap.yaml new file mode 100644 index 0000000000..c5cc85687e --- /dev/null +++ b/task/catlin-validate/0.1/samples/input-configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: catlin-input +data: + input.txt: | + task/hello/0.1/hello.yaml \ No newline at end of file diff --git a/task/catlin-validate/0.1/tests/source-error-configmap.yaml b/task/catlin-validate/0.1/samples/source-error-task-configmap.yaml similarity index 89% rename from task/catlin-validate/0.1/tests/source-error-configmap.yaml rename to task/catlin-validate/0.1/samples/source-error-task-configmap.yaml index f0b0e32c09..6cd5cbbc25 100644 --- a/task/catlin-validate/0.1/tests/source-error-configmap.yaml +++ b/task/catlin-validate/0.1/samples/source-error-task-configmap.yaml @@ -14,4 +14,4 @@ data: image: alpine script: | #!/bin/sh - echo "Hello World" \ No newline at end of file + echo "Hello World" \ No newline at end of file diff --git a/task/catlin-validate/0.1/tests/taskrun-error.yaml b/task/catlin-validate/0.1/samples/taskrun-error.yaml similarity index 100% rename from task/catlin-validate/0.1/tests/taskrun-error.yaml rename to task/catlin-validate/0.1/samples/taskrun-error.yaml diff --git a/task/catlin-validate/0.1/tests/input-configmap.yaml b/task/catlin-validate/0.1/tests/input-configmap.yaml index 17580ede12..c5cc85687e 100644 --- a/task/catlin-validate/0.1/tests/input-configmap.yaml +++ b/task/catlin-validate/0.1/tests/input-configmap.yaml @@ -1,4 +1,3 @@ - apiVersion: v1 kind: ConfigMap metadata: diff --git a/task/catlin-validate/0.1/tests/multiple-input-configmap.yaml b/task/catlin-validate/0.1/tests/multiple-input-configmap.yaml index bcb5fab4ee..dd938fdff7 100644 --- a/task/catlin-validate/0.1/tests/multiple-input-configmap.yaml +++ b/task/catlin-validate/0.1/tests/multiple-input-configmap.yaml @@ -1,4 +1,3 @@ - apiVersion: v1 kind: ConfigMap metadata: diff --git a/task/catlin-validate/0.1/tests/source-multiple-configmap.yaml b/task/catlin-validate/0.1/tests/source-multiple-tasks-configmap.yaml similarity index 100% rename from task/catlin-validate/0.1/tests/source-multiple-configmap.yaml rename to task/catlin-validate/0.1/tests/source-multiple-tasks-configmap.yaml diff --git a/task/catlin-validate/0.1/tests/source-success-configmap.yaml b/task/catlin-validate/0.1/tests/source-success-task-configmap.yaml similarity index 100% rename from task/catlin-validate/0.1/tests/source-success-configmap.yaml rename to task/catlin-validate/0.1/tests/source-success-task-configmap.yaml diff --git a/task/catlin-validate/0.1/tests/source-warn-configmap.yaml b/task/catlin-validate/0.1/tests/source-warn-task-configmap.yaml similarity index 100% rename from task/catlin-validate/0.1/tests/source-warn-configmap.yaml rename to task/catlin-validate/0.1/tests/source-warn-task-configmap.yaml