@@ -84,6 +84,8 @@ struct GenerateMonitorAction {
84
84
pipeline_out : String ,
85
85
#[ clap( long, default_value_t = DEFAULT_PIPELINE_JOB_PREFIX . to_owned( ) ) ]
86
86
job_prefix : String ,
87
+ #[ clap( long) ]
88
+ job_timeout : Option < String > ,
87
89
#[ clap( long, default_value_t = DEFAULT_ARTIFACT_EXPIRATION . to_owned( ) ) ]
88
90
artifact_expiration : String ,
89
91
#[ clap( long, default_value_t = DEFAULT_BUILD_LOG . into( ) ) ]
@@ -410,6 +412,7 @@ impl ObsJobHandler {
410
412
tags : vec ! [ args. tag] ,
411
413
artifact_expiration : args. artifact_expiration ,
412
414
prefix : args. job_prefix ,
415
+ timeout : args. job_timeout ,
413
416
rules : args. rules ,
414
417
download_binaries : if let Some ( build_results_dir) = args. build_results_dir {
415
418
PipelineDownloadBinaries :: OnSuccess {
@@ -1266,6 +1269,7 @@ mod tests {
1266
1269
download_binaries : bool ,
1267
1270
) {
1268
1271
const TEST_JOB_RUNNER_TAG : & str = "test-tag" ;
1272
+ const TEST_MONITOR_TIMEOUT : & str = "1 day" ;
1269
1273
const TEST_BUILD_RESULTS_DIR : & str = "results" ;
1270
1274
const TEST_BUILD_RESULT : & str = "test-build-result" ;
1271
1275
const TEST_BUILD_RESULT_CONTENTS : & [ u8 ] = b"abcdef" ;
@@ -1307,8 +1311,8 @@ mod tests {
1307
1311
) ;
1308
1312
1309
1313
let mut generate_command = format ! (
1310
- "generate-monitor {} --rules '[{{a: 1}}, {{b: 2}}]'" ,
1311
- TEST_JOB_RUNNER_TAG
1314
+ "generate-monitor {} --job-timeout '{}' -- rules '[{{a: 1}}, {{b: 2}}]'" ,
1315
+ TEST_JOB_RUNNER_TAG , TEST_MONITOR_TIMEOUT
1312
1316
) ;
1313
1317
if download_binaries {
1314
1318
generate_command += & format ! ( " --download-build-results-to {}" , TEST_BUILD_RESULTS_DIR ) ;
@@ -1432,6 +1436,13 @@ mod tests {
1432
1436
assert_eq ! ( tags. len( ) , 1 ) ;
1433
1437
assert_eq ! ( tags[ 0 ] . as_str( ) . unwrap( ) , TEST_JOB_RUNNER_TAG ) ;
1434
1438
1439
+ let timeout = monitor_map
1440
+ . get ( & "timeout" . into ( ) )
1441
+ . unwrap ( )
1442
+ . as_str ( )
1443
+ . unwrap ( ) ;
1444
+ assert_eq ! ( timeout, TEST_MONITOR_TIMEOUT ) ;
1445
+
1435
1446
let rules: Vec < _ > = monitor_map
1436
1447
. get ( & "rules" . into ( ) )
1437
1448
. unwrap ( )
0 commit comments