-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathshellscript-config.yaml
102 lines (99 loc) · 2.69 KB
/
shellscript-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This example is with the new pipeline oriented design, for the old
# (deprecated, but working) configuration see: legacy/shellscript-config.yaml
pipeline:
- type: processor.genericjson
- type: processor.shellscript
output: shell_json
config:
command: /bin/bash
args:
- '-c'
- |
while read line
do
echo "{ \"line\": \"$line\" }"
done
echo $STDERR_MSG > /dev/stderr
environment:
STDERR_MSG: 'Standard Error'
stdin: |
Hello
World
# Set json to true, if output is JSON (single line)
json: true
#
# Set jsonMultiline to true, if output is JSON (multiline)
jsonMultiline: true
#
# Set yaml to true, if output is YAML
# yaml: true
#
# Set csv to true, if output is comma separated values
# csv: true
#
# Set tsv to true, if output is tab separated values
# tsv: true
#
# Script is successful on either exit code 0 or 1, default 0
exitcodes:
- 0
- 1
- type: output.logger
config:
message: "JSON returned: {{ shell_json }}"
- type: processor.shellscript
output: shell_yaml
config:
command: /bin/bash
args:
- '-c'
- |
while read line
do
echo $line
done
stdin: |
{{ { "hello" : "world" }|yaml_encode }}
yaml: true
- type: output.logger
config:
message: "YAML returned: {{ shell_yaml }}"
- type: processor.shellscript
output: shell_csv
config:
command: /bin/bash
args:
- '-c'
- |
echo '"Hello","World","From","CSV"'
echo "Line,\"Break"
echo "Here\",In,CSV"
csv: true
- type: output.logger
config:
message: "CSV returned: {{ shell_csv }}"
- type: processor.shellscript
output: shell_tsv
config:
command: /bin/bash
args:
- '-c'
- |
echo -e "Hello\tWorld"
tsv: true
- type: output.logger
config:
message: "TSV returned: {{ shell_tsv }}"