1/* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto3"; 18 19package luci.resultdb.v1; 20 21import "google/api/field_behavior.proto"; 22import "google/protobuf/timestamp.proto"; 23import public "tools/tradefederation/core/proto/resultdb/test_result.proto"; 24 25option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb"; 26option java_package = "com.android.resultdb.proto"; 27option java_multiple_files = true; 28 29// A file produced during a build/test, typically a test artifact. 30// The parent resource is either a TestResult or an Invocation. 31// 32// An invocation-level artifact might be related to tests, or it might not, for 33// example it may be used to store build step logs when streaming support is 34// added. 35// Next id: 11. 36message Artifact { 37 // Can be used to refer to this artifact. 38 // Format: 39 // - For invocation-level artifacts: 40 // "invocations/{INVOCATION_ID}/artifacts/{ARTIFACT_ID}". 41 // - For test-result-level artifacts: 42 // "invocations/{INVOCATION_ID}/tests/{URL_ESCAPED_TEST_ID}/results/{RESULT_ID}/artifacts/{ARTIFACT_ID}". 43 // where URL_ESCAPED_TEST_ID is the test_id escaped with 44 // https://golang.org/pkg/net/url/#PathEscape (see also https://aip.dev/122), 45 // and ARTIFACT_ID is documented below. 46 // Examples: "screenshot.png", "traces/a.txt". 47 string name = 1; 48 49 // A local identifier of the artifact, unique within the parent resource. 50 // MAY have slashes, but MUST NOT start with a slash. 51 // SHOULD not use backslashes. 52 // Regex: ^(?:[[:word:]]|\.)([\p{L}\p{M}\p{N}\p{P}\p{S}\p{Zs}]{0,254}[[:word:]])?$ 53 string artifact_id = 2; 54 55 // A signed short-lived URL to fetch the contents of the artifact. 56 // See also fetch_url_expiration. 57 string fetch_url = 3; 58 59 // When fetch_url expires. If expired, re-request this Artifact. 60 google.protobuf.Timestamp fetch_url_expiration = 4; 61 62 // Media type of the artifact. 63 // Logs are typically "text/plain" and screenshots are typically "image/png". 64 // Optional. 65 string content_type = 5; 66 67 // Size of the file. 68 // Can be used in UI to decide between displaying the artifact inline or only 69 // showing a link if it is too large. 70 // If you are using the gcs_uri, this field is not verified, but only treated as a hint. 71 int64 size_bytes = 6; 72 73 // Contents of the artifact. 74 // This is INPUT_ONLY, and taken by BatchCreateArtifacts(). 75 // All getter RPCs, such as ListArtifacts(), do not populate values into 76 // the field in the response. 77 // If specified, `gcs_uri` must be empty. 78 bytes contents = 7 [ (google.api.field_behavior) = INPUT_ONLY ]; 79 80 // The GCS URI of the artifact if it's stored in GCS. If specified, `contents` must be empty. 81 string gcs_uri = 8; 82 83 // Status of the test result that the artifact belongs to. 84 // This is only applicable for test-level artifacts, not invocation-level artifacts. 85 // We need this field because when an artifact is created (for example, with BatchCreateArtifact), 86 // the containing test result may or may not be created yet, as they 87 // are created in different channels from result sink. 88 // Having the test status here allows setting the correct status of artifact in BigQuery. 89 TestStatus test_status = 9; 90 91 // Indicates whether ListArtifactLines RPC can be used with this artifact. 92 bool has_lines = 11; 93} 94 95message ArtifactLine { 96 enum Severity { 97 SEVERITY_UNSPECIFIED = 0; 98 VERBOSE = 10; 99 TRACE = 20; 100 DEBUG = 30; 101 INFO = 40; 102 NOTICE = 50; 103 WARNING = 60; 104 ERROR = 70; 105 CRITICAL = 80; 106 FATAL = 90; 107 } 108 109 // The position of this line in the artifact. 110 // The numbers start from 1. 111 int64 number = 1; 112 113 // The extracted timestamp of the log line. Extraction is best effort only. 114 google.protobuf.Timestamp timestamp = 2; 115 116 // The extracted severity of the line. Extraction is best effort only. 117 Severity severity = 3; 118 119 // The content of the line as it is found in the log file. 120 // Lines are split on the \n character and the character is included in the line content that immediately precedes it. 121 // Empty lines will be included in the response. 122 bytes content = 4; 123}