aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/pkg/workflow/template.yaml
blob: 31b21756672fe1fcea1d43779154885bbd37a30a (plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Copyright 2025 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: series-workflow
spec:
  entrypoint: main
  podGC:
    # Keep pods for 12 hours after completion.
    strategy: OnPodCompletion
    deleteDelayDuration: 12h
  ttlStrategy:
    # Keep finihed workflows for 12 hours after completion.
    secondsAfterCompletion: 43200
  podMetadata:
    labels:
      tier: workflow
  arguments:
    parameters:
      - name: session-id
        value: "some-session-id"
# TODO: there seems to be no way to pass env variables into the GC workflow.
# Set ARGO_ARTIFACT_GC_ENABLED=0 for the local setup?
#  artifactGC:
#    strategy: OnWorkflowCompletion
  templates:
    - name: main
      # Don't schedule new steps if any of the previous steps failed.
      failFast: true
      # Note that failFast and parallelism only affect this template's steps.
      parallelism: 1
      steps:
        - - name: run-triage
            templateRef:
              name: triage-step-template
              template: triage-step
        - - name: abort-on-skip-outcome
            template: exit-workflow
            when: "{{=jsonpath(steps['run-triage'].outputs.parameters.result, '$.skip_reason') != ''}}"
        - - name: run-process-fuzz
            template: process-fuzz
            arguments:
              parameters:
                - name: element
                  value: "{{item}}"
            withParam: "{{=jsonpath(steps['run-triage'].outputs.parameters.result, '$.fuzz')}}"
            continueOn:
              failed: true
    - name: process-fuzz
      inputs:
        parameters:
          - name: element
      steps:
        - - name: save-base-req
            template: convert-artifact
            arguments:
              parameters:
                - name: data
                  value: "{{=jsonpath(inputs.parameters.element, '$.base')}}"
        - - name: base-build
            templateRef:
              name: build-step-template
              template: build-step
            arguments:
              parameters:
                - name: test-name
                  value: "[{{=jsonpath(inputs.parameters.element, '$.track')}}] Build Base"
                - name: session-id
                  value: "{{workflow.parameters.session-id}}"
              artifacts:
                - name: request
                  from: "{{steps.save-base-req.outputs.artifacts.artifact}}"
        - - name: abort-if-base-build-failed
            template: exit-workflow
            when: "{{=jsonpath(steps['base-build'].outputs.parameters.result, '$.success') == false}}"
        - - name: save-patched-req
            template: convert-artifact
            arguments:
              parameters:
                - name: data
                  value: "{{=jsonpath(inputs.parameters.element, '$.patched')}}"
        - - name: boot-test-base
            templateRef:
              name: boot-step-template
              template: boot-step
            arguments:
              artifacts:
                - name: kernel
                  from: "{{steps.base-build.outputs.artifacts.kernel}}"
              parameters:
                - name: config
                  value: "{{=jsonpath(inputs.parameters.element, '$.config')}}"
                - name: base-build-id
                  value: "{{=jsonpath(steps['base-build'].outputs.parameters.result, '$.build_id')}}"
                - name: test-name
                  value: "[{{=jsonpath(inputs.parameters.element, '$.track')}}] Boot test: Base"
        - - name: abort-if-base-boot-failed
            template: exit-workflow
            when: "{{=jsonpath(steps['boot-test-base'].outputs.parameters.result, '$.success') == false}}"
        - - name: patched-build
            templateRef:
              name: build-step-template
              template: build-step
            arguments:
              parameters:
                - name: test-name
                  value: "[{{=jsonpath(inputs.parameters.element, '$.track')}}] Build Patched"
                - name: findings
                  value: "true"
                - name: session-id
                  value: "{{workflow.parameters.session-id}}"
              artifacts:
                - name: request
                  from: "{{steps.save-patched-req.outputs.artifacts.artifact}}"
        - - name: abort-if-patched-build-failed
            template: exit-workflow
            when: "{{=jsonpath(steps['patched-build'].outputs.parameters.result, '$.success') == false}}"
        - - name: boot-test-patched
            templateRef:
              name: boot-step-template
              template: boot-step
            arguments:
              artifacts:
                - name: kernel
                  from: "{{steps.patched-build.outputs.artifacts.kernel}}"
              parameters:
                - name: config
                  value: "{{=jsonpath(inputs.parameters.element, '$.config')}}"
                - name: patched-build-id
                  value: "{{=jsonpath(steps['patched-build'].outputs.parameters.result, '$.build_id')}}"
                - name: report-findings
                  value: "true"
                - name: test-name
                  value: "[{{=jsonpath(inputs.parameters.element, '$.track')}}] Boot test: Patched"
        - - name: abort-if-patched-boot-failed
            template: exit-workflow
            when: "{{=jsonpath(steps['boot-test-patched'].outputs.parameters.result, '$.success') == false}}"
        - - name: save-fuzz-config
            template: convert-artifact
            arguments:
              parameters:
                - name: data
                  value: "{{=jsonpath(inputs.parameters.element, '$')}}"
        - - name: fuzz
            templateRef:
              name: fuzz-step-template
              template: fuzz-step
            arguments:
              parameters:
                - name: patched-build-id
                  value: "{{=jsonpath(steps['patched-build'].outputs.parameters.result, '$.build_id')}}"
                - name: base-build-id
                  value: "{{=jsonpath(steps['base-build'].outputs.parameters.result, '$.build_id')}}"
              artifacts:
                - name: base-kernel
                  from: "{{steps.base-build.outputs.artifacts.kernel}}"
                - name: patched-kernel
                  from: "{{steps.patched-build.outputs.artifacts.kernel}}"
                - name: config
                  from: "{{steps.save-fuzz-config.outputs.artifacts.artifact}}"
    - name: convert-artifact
      inputs:
        parameters:
          - name: data
      outputs:
        artifacts:
          - name: artifact
            path: /tmp/artifact
      container:
        image: alpine:latest
        command: [sh, -c]
        args: ["echo '{{inputs.parameters.data}}' > /tmp/artifact"]
    - name: exit-workflow
      inputs:
        parameters:
          - name: code
            value: 1
      container:
        image: alpine:latest
        command: ['/bin/sh', '-c']
        args: ["exit {{inputs.parameters.code}}"]