• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto3";
6
7package chromiumos.test.api;
8
9option go_package = "go.chromium.org/chromiumos/config/go/test/api";
10
11import "google/protobuf/any.proto";
12import "chromiumos/test/api/trv2_dynamic.proto";
13
14// UserDefinedDynamicUpdate is what updates a dynamic trv2 request.
15message UserDefinedDynamicUpdate {
16    FocalTaskFinder focal_task_finder = 1;
17    UpdateAction update_action = 2;
18}
19
20// FocalTaskFinder describes which task is the update based around.
21message FocalTaskFinder {
22    // TaskType defines which task type is being targeted.
23    enum TaskType {
24        PROVISION = 0;
25        PRETEST = 1;
26        TEST= 2;
27        POSTTEST = 3;
28        PUBLISH = 4;
29        GENERIC = 5;
30    }
31    // First gives back the first task that is of the type provided.
32    message First {
33        TaskType task_type = 1;
34    }
35    // Last gives back the last task that is of the type provided.
36    message Last {
37        TaskType task_type = 1;
38    }
39    // Beginning always gives the first task in the list, ie the 0th index.
40    message Beginning {}
41    // End always gives the last task in the list, ie the len(list)-1 index.
42    message End {}
43    // ByDynamicIdentifier is a lookup finder that finds the task
44    // with the given dynamic identifier set.
45    message ByDynamicIdentifier {
46        string dynamic_identifier = 1;
47    }
48
49    oneof finder {
50        First first = 1;
51        Last last = 2;
52        Beginning beginning = 3;
53        End end = 4;
54        ByDynamicIdentifier by_dynamic_identifier = 5;
55    }
56}
57
58// UpdateAction describes what action will be taken around the focal task.
59message UpdateAction {
60    // Insert places the entire task provided within the ordered
61    // task list based on the insert type.
62    message Insert {
63        // InsertType describes how the task should be placed within
64        // ordered task list around the focal task.
65        enum InsertType {
66            APPEND = 0;
67            PREPEND = 1;
68            REPLACE = 2;
69        }
70        InsertType insert_type = 1;
71        // Task payload that will be inserted into the task list.
72        CrosTestRunnerDynamicRequest.Task task = 2;
73    }
74    // Remove will fully remove the focal task, shrinking
75    // the ordered task list by one.
76    message Remove {}
77    // Modify deploys in-place modifications to the focal task
78    // based on the given payloads and their corresponding instructions.
79    message Modify {
80        message Modification {
81            // Payload is the reference object for modifying the task in-place.
82            google.protobuf.Any payload = 1;
83            // Instructions follow the DynamicDeps formatting rules in which the
84            // key represents where in the task the modification is occurring, and
85            // the value represents which part of the payload is being deployed to
86            // that portion of the task.
87            // Note: An empty value within an instruction represents a one-to-one
88            //  mapping between the type of the modified task portion and the payload.
89            //
90            // Example:
91            //  Payload = {
92            //      Value = "example string"
93            //  }
94            //  Instructions = {
95            //      "provision.provisionRequest.target": "value"
96            //  }
97            map<string, string> instructions = 2;
98        }
99        // May bundle modifications within a single action.
100        repeated Modification modifications = 1;
101    }
102
103    oneof action {
104        Insert insert = 1;
105        Remove remove = 2;
106        Modify modify = 3;
107    }
108}
109