blob: 7bf8231005dbf9153e5390cade832e493b0b401b [file] [log] [blame]
buchgr2730bae2017-06-08 23:56:05 +02001// Copyright 2017 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package com.google.devtools.build.lib.buildeventservice;
16
Googler62c94742017-11-07 19:09:52 +010017import com.google.devtools.common.options.Converters;
lpinod143ca42019-04-15 04:27:39 -070018import com.google.devtools.common.options.EnumConverter;
buchgr2730bae2017-06-08 23:56:05 +020019import com.google.devtools.common.options.Option;
ccalvarin3bc15472017-06-27 17:58:35 +020020import com.google.devtools.common.options.OptionDocumentationCategory;
ccalvarinc82a1972017-07-17 21:13:39 +020021import com.google.devtools.common.options.OptionEffectTag;
buchgr2730bae2017-06-08 23:56:05 +020022import com.google.devtools.common.options.OptionsBase;
ulfjackf9625f02017-07-24 13:01:29 +020023import java.time.Duration;
Googler7477c7a2017-09-26 18:42:09 -040024import java.util.List;
buchgr2730bae2017-06-08 23:56:05 +020025
26/** Options used by {@link BuildEventServiceModule}. */
27public class BuildEventServiceOptions extends OptionsBase {
28
29 @Option(
ccalvarin3bc15472017-06-27 17:58:35 +020030 name = "bes_backend",
31 defaultValue = "",
aehlig669fcbb2017-06-28 17:15:34 +020032 documentationCategory = OptionDocumentationCategory.LOGGING,
33 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
ccalvarin3bc15472017-06-27 17:58:35 +020034 help =
35 "Specifies the build event service (BES) backend endpoint as HOST or HOST:PORT. "
36 + "Disabled by default."
buchgr2730bae2017-06-08 23:56:05 +020037 )
38 public String besBackend;
39
40 @Option(
ccalvarin3bc15472017-06-27 17:58:35 +020041 name = "bes_timeout",
42 defaultValue = "0s",
aehlig669fcbb2017-06-28 17:15:34 +020043 documentationCategory = OptionDocumentationCategory.LOGGING,
44 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
ccalvarin3bc15472017-06-27 17:58:35 +020045 help =
46 "Specifies how long bazel should wait for the BES/BEP upload to complete after the "
47 + "build and tests have finished. A valid timeout is a natural number followed by a "
48 + "unit: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). The "
buchgr8c6a8892018-09-20 08:30:47 -070049 + "default value is '0' which means that there is no timeout."
buchgr2730bae2017-06-08 23:56:05 +020050 )
51 public Duration besTimeout;
52
53 @Option(
ulfjack1b97ae082018-06-07 05:29:38 -070054 name = "bes_best_effort",
55 defaultValue = "false",
56 deprecationWarning =
57 "BES best effort upload has been removed. The flag has no more "
58 + "functionality attached to it and will be removed in a future release.",
59 documentationCategory = OptionDocumentationCategory.LOGGING,
60 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
61 help =
62 "BES best effort upload has been removed. The flag has no more "
63 + "functionality attached to it and will be removed in a future release.")
buchgr2730bae2017-06-08 23:56:05 +020064 public boolean besBestEffort;
65
66 @Option(
ccalvarin3bc15472017-06-27 17:58:35 +020067 name = "bes_lifecycle_events",
68 defaultValue = "true",
aehlig669fcbb2017-06-28 17:15:34 +020069 documentationCategory = OptionDocumentationCategory.LOGGING,
70 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
ccalvarin3bc15472017-06-27 17:58:35 +020071 help = "Specifies whether to publish BES lifecycle events. (defaults to 'true')."
buchgr2730bae2017-06-08 23:56:05 +020072 )
73 public boolean besLifecycleEvents;
74
75 @Option(
ccalvarin3bc15472017-06-27 17:58:35 +020076 name = "project_id",
77 defaultValue = "null",
aehlig669fcbb2017-06-28 17:15:34 +020078 documentationCategory = OptionDocumentationCategory.LOGGING,
79 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
ccalvarin3bc15472017-06-27 17:58:35 +020080 help = "Specifies the BES project identifier. Defaults to null."
buchgr2730bae2017-06-08 23:56:05 +020081 )
82 public String projectId;
Googler7477c7a2017-09-26 18:42:09 -040083
84 @Option(
85 name = "bes_keywords",
86 defaultValue = "",
Googler62c94742017-11-07 19:09:52 +010087 converter = Converters.CommaSeparatedOptionListConverter.class,
Googler7477c7a2017-09-26 18:42:09 -040088 documentationCategory = OptionDocumentationCategory.LOGGING,
89 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
90 allowMultiple = true,
91 help =
92 "Specifies a list of notification keywords to be added the default set of keywords "
93 + "published to BES (\"command_name=<command_name> \", \"protocol_name=BEP\"). "
94 + "Defaults to none."
95 )
96 public List<String> besKeywords;
Klaus Aehligad0d7e92018-01-11 00:23:45 -080097
98 @Option(
felly17594762019-02-07 15:24:32 -080099 name = "bes_outerr_buffer_size",
100 defaultValue = "10240",
101 documentationCategory = OptionDocumentationCategory.LOGGING,
102 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
103 help =
104 "Specifies the maximal size of stdout or stderr to be buffered in BEP, before it is "
105 + "reported as a progress event. Individual writes are still reported in a single "
fellyd17271f2019-02-15 09:41:31 -0800106 + "event, even if larger than the specified value up to --bes_outerr_chunk_size.")
felly17594762019-02-07 15:24:32 -0800107 public int besOuterrBufferSize;
Jakob Buchgraberd06a3662018-05-07 08:03:06 -0700108
109 @Option(
fellyd17271f2019-02-15 09:41:31 -0800110 name = "bes_outerr_chunk_size",
111 defaultValue = "1048576", // 2^20 = 1MB
112 documentationCategory = OptionDocumentationCategory.LOGGING,
113 effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
114 help =
115 "Specifies the maximal size of stdout or stderr to be sent to BEP in a single message.")
116 public int besOuterrChunkSize;
117
118 @Option(
Jakob Buchgraberd06a3662018-05-07 08:03:06 -0700119 name = "bes_results_url",
120 defaultValue = "",
121 documentationCategory = OptionDocumentationCategory.LOGGING,
122 effectTags = {OptionEffectTag.TERMINAL_OUTPUT},
123 help =
124 "Specifies the base URL where a user can view the information streamed to the BES"
125 + " backend. Bazel will output the URL appended by the invocation id to the"
126 + " terminal.")
127 public String besResultsUrl;
lpinod143ca42019-04-15 04:27:39 -0700128
129 @Option(
130 name = "bes_upload_mode",
lpino41d4f752019-04-17 06:36:47 -0700131 defaultValue = "wait_for_upload_complete",
lpinod143ca42019-04-15 04:27:39 -0700132 converter = BesUploadModeConverter.class,
133 documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
134 effectTags = {OptionEffectTag.EAGERNESS_TO_EXIT},
135 help =
136 "Specifies whether the Build Event Service upload should block the build completion "
137 + "or should end the invocation immediately and finish the upload in the background.")
138 public BesUploadMode besUploadMode;
139
140 /** Determines the mode that will be used to upload data to the Build Event Service. */
141 public enum BesUploadMode {
felly67641002019-04-23 09:31:25 -0700142 /** Block at the end of the build waiting for the upload to complete */
lpinod143ca42019-04-15 04:27:39 -0700143 WAIT_FOR_UPLOAD_COMPLETE,
felly67641002019-04-23 09:31:25 -0700144 /** Block at the beginning of the next build waiting for upload completion */
145 NOWAIT_FOR_UPLOAD_COMPLETE,
146 /**
147 * Block at the beginning of the next build waiting for the client to finish uploading the data,
148 * but possibly not blocking on the server acknowledgement.
149 */
150 FULLY_ASYNC,
lpinod143ca42019-04-15 04:27:39 -0700151 }
152
153 /** Converter for {@link BesUploadMode} */
154 public static class BesUploadModeConverter extends EnumConverter<BesUploadMode> {
155 public BesUploadModeConverter() {
156 super(BesUploadMode.class, "Mode for uploading to the Build Event Service");
157 }
158 }
buchgr2730bae2017-06-08 23:56:05 +0200159}