github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/syz-cluster/workflow/rebuild-kernels-cron.yaml (about) 1 # Copyright 2025 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 # Do smoke builds of all kernel repositories that might be used as base kernels. 5 # The kernels will be rebuilt only if there are newer commits available, so 6 # it's okay to invoke this workflow often. 7 # TODO: once we switch to some build service, ensure that these are cached. 8 9 apiVersion: argoproj.io/v1alpha1 10 kind: CronWorkflow 11 metadata: 12 name: rebuild-kernels-cron 13 spec: 14 # Three times per day. 15 schedule: "30 */8 * * *" 16 concurrencyPolicy: "Replace" 17 startingDeadlineSeconds: 0 18 workflowSpec: 19 entrypoint: main 20 podMetadata: 21 labels: 22 tier: workflow 23 podGC: 24 strategy: OnPodCompletion 25 deleteDelayDuration: 12h 26 ttlStrategy: 27 secondsAfterCompletion: 86400 28 templates: 29 - name: main 30 parallelism: 1 31 steps: 32 - - name: query-data 33 template: query-data-template 34 - - name: prepare-build-requests 35 template: prepare-build-requests-template 36 arguments: 37 parameters: 38 - name: response 39 value: "{{steps.query-data.outputs.result}}" 40 - - name: iterate-builds 41 template: process-build-request 42 arguments: 43 parameters: 44 - name: request-json 45 value: "{{item}}" 46 withParam: "{{steps.prepare-build-requests.outputs.result}}" 47 continueOn: 48 failed: true 49 - name: query-data-template 50 http: 51 url: "http://controller-service:8080/trees" 52 method: "GET" 53 - name: prepare-build-requests-template 54 inputs: 55 parameters: 56 - name: response 57 script: 58 image: python:3.9 59 command: [python] 60 source: | 61 import json 62 import sys 63 64 data = json.loads('''{{inputs.parameters.response}}''') 65 unique_kernel_configs = sorted(list(set( 66 campaign["kernel_config"] 67 for fuzz_config in data.get("fuzz_targets", []) 68 for campaign in fuzz_config.get("campaigns", []) 69 ))) 70 build_requests = [] 71 for tree in data.get("trees", []): 72 for config_name in unique_kernel_configs: 73 build_request = { 74 "arch": "amd64", # TODO: consider others as well. 75 "tree_name": tree["name"], 76 "tree_url": tree["URL"], 77 "commit_hash": tree["branch"], 78 "config_name": config_name 79 } 80 build_requests.append(build_request) 81 print(json.dumps(build_requests)) 82 83 - name: process-build-request 84 inputs: 85 parameters: 86 - name: request-json 87 steps: 88 - - name: create-request-artifact 89 template: request-to-artifact 90 arguments: 91 parameters: 92 - name: data 93 value: "{{inputs.parameters.request-json}}" 94 - - name: run-build 95 templateRef: 96 name: build-step-template 97 template: build-step 98 arguments: 99 parameters: 100 - name: smoke-build 101 value: "true" 102 artifacts: 103 - name: request 104 from: "{{steps.create-request-artifact.outputs.artifacts.request}}" 105 - name: request-to-artifact 106 inputs: 107 parameters: 108 - name: data 109 outputs: 110 artifacts: 111 - name: request 112 path: /tmp/request.json 113 script: 114 image: alpine:latest 115 command: [sh, -c] 116 source: | 117 printf '%s' '{{inputs.parameters.data}}' > /tmp/request.json