@@ -233,6 +233,27 @@ you attempt to use them.
233
233
If you built an image in a previous build step, it will be stored in the
234
234
host's Docker daemon's cache and is available to use as the name for a
235
235
later build step.` ,
236
+ },
237
+ "allow_exit_codes" : {
238
+ Type : schema .TypeList ,
239
+ Optional : true ,
240
+ Description : `Allow this build step to fail without failing the entire build if and
241
+ only if the exit code is one of the specified codes.
242
+
243
+ If 'allowFailure' is also specified, this field will take precedence.` ,
244
+ Elem : & schema.Schema {
245
+ Type : schema .TypeInt ,
246
+ },
247
+ },
248
+ "allow_failure" : {
249
+ Type : schema .TypeBool ,
250
+ Optional : true ,
251
+ Description : `Allow this build step to fail without failing the entire build.
252
+ If false, the entire build will fail if this step fails. Otherwise, the
253
+ build will succeed, but this step will still have a failure status.
254
+ Error information will be reported in the 'failureDetail' field.
255
+
256
+ 'allowExitCodes' takes precedence over this field.` ,
236
257
},
237
258
"args" : {
238
259
Type : schema .TypeList ,
@@ -2394,18 +2415,20 @@ func flattenCloudBuildTriggerBuildStep(v interface{}, d *schema.ResourceData, co
2394
2415
continue
2395
2416
}
2396
2417
transformed = append (transformed , map [string ]interface {}{
2397
- "name" : flattenCloudBuildTriggerBuildStepName (original ["name" ], d , config ),
2398
- "args" : flattenCloudBuildTriggerBuildStepArgs (original ["args" ], d , config ),
2399
- "env" : flattenCloudBuildTriggerBuildStepEnv (original ["env" ], d , config ),
2400
- "id" : flattenCloudBuildTriggerBuildStepId (original ["id" ], d , config ),
2401
- "entrypoint" : flattenCloudBuildTriggerBuildStepEntrypoint (original ["entrypoint" ], d , config ),
2402
- "dir" : flattenCloudBuildTriggerBuildStepDir (original ["dir" ], d , config ),
2403
- "secret_env" : flattenCloudBuildTriggerBuildStepSecretEnv (original ["secretEnv" ], d , config ),
2404
- "timeout" : flattenCloudBuildTriggerBuildStepTimeout (original ["timeout" ], d , config ),
2405
- "timing" : flattenCloudBuildTriggerBuildStepTiming (original ["timing" ], d , config ),
2406
- "volumes" : flattenCloudBuildTriggerBuildStepVolumes (original ["volumes" ], d , config ),
2407
- "wait_for" : flattenCloudBuildTriggerBuildStepWaitFor (original ["waitFor" ], d , config ),
2408
- "script" : flattenCloudBuildTriggerBuildStepScript (original ["script" ], d , config ),
2418
+ "name" : flattenCloudBuildTriggerBuildStepName (original ["name" ], d , config ),
2419
+ "args" : flattenCloudBuildTriggerBuildStepArgs (original ["args" ], d , config ),
2420
+ "env" : flattenCloudBuildTriggerBuildStepEnv (original ["env" ], d , config ),
2421
+ "id" : flattenCloudBuildTriggerBuildStepId (original ["id" ], d , config ),
2422
+ "entrypoint" : flattenCloudBuildTriggerBuildStepEntrypoint (original ["entrypoint" ], d , config ),
2423
+ "dir" : flattenCloudBuildTriggerBuildStepDir (original ["dir" ], d , config ),
2424
+ "secret_env" : flattenCloudBuildTriggerBuildStepSecretEnv (original ["secretEnv" ], d , config ),
2425
+ "timeout" : flattenCloudBuildTriggerBuildStepTimeout (original ["timeout" ], d , config ),
2426
+ "timing" : flattenCloudBuildTriggerBuildStepTiming (original ["timing" ], d , config ),
2427
+ "volumes" : flattenCloudBuildTriggerBuildStepVolumes (original ["volumes" ], d , config ),
2428
+ "wait_for" : flattenCloudBuildTriggerBuildStepWaitFor (original ["waitFor" ], d , config ),
2429
+ "script" : flattenCloudBuildTriggerBuildStepScript (original ["script" ], d , config ),
2430
+ "allow_failure" : flattenCloudBuildTriggerBuildStepAllowFailure (original ["allowFailure" ], d , config ),
2431
+ "allow_exit_codes" : flattenCloudBuildTriggerBuildStepAllowExitCodes (original ["allowExitCodes" ], d , config ),
2409
2432
})
2410
2433
}
2411
2434
return transformed
@@ -2481,6 +2504,14 @@ func flattenCloudBuildTriggerBuildStepScript(v interface{}, d *schema.ResourceDa
2481
2504
return v
2482
2505
}
2483
2506
2507
+ func flattenCloudBuildTriggerBuildStepAllowFailure (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2508
+ return v
2509
+ }
2510
+
2511
+ func flattenCloudBuildTriggerBuildStepAllowExitCodes (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2512
+ return v
2513
+ }
2514
+
2484
2515
func flattenCloudBuildTriggerBuildArtifacts (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2485
2516
if v == nil {
2486
2517
return nil
@@ -3840,6 +3871,20 @@ func expandCloudBuildTriggerBuildStep(v interface{}, d TerraformResourceData, co
3840
3871
transformed ["script" ] = transformedScript
3841
3872
}
3842
3873
3874
+ transformedAllowFailure , err := expandCloudBuildTriggerBuildStepAllowFailure (original ["allow_failure" ], d , config )
3875
+ if err != nil {
3876
+ return nil , err
3877
+ } else if val := reflect .ValueOf (transformedAllowFailure ); val .IsValid () && ! isEmptyValue (val ) {
3878
+ transformed ["allowFailure" ] = transformedAllowFailure
3879
+ }
3880
+
3881
+ transformedAllowExitCodes , err := expandCloudBuildTriggerBuildStepAllowExitCodes (original ["allow_exit_codes" ], d , config )
3882
+ if err != nil {
3883
+ return nil , err
3884
+ } else if val := reflect .ValueOf (transformedAllowExitCodes ); val .IsValid () && ! isEmptyValue (val ) {
3885
+ transformed ["allowExitCodes" ] = transformedAllowExitCodes
3886
+ }
3887
+
3843
3888
req = append (req , transformed )
3844
3889
}
3845
3890
return req , nil
@@ -3926,6 +3971,14 @@ func expandCloudBuildTriggerBuildStepScript(v interface{}, d TerraformResourceDa
3926
3971
return v , nil
3927
3972
}
3928
3973
3974
+ func expandCloudBuildTriggerBuildStepAllowFailure (v interface {}, d TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3975
+ return v , nil
3976
+ }
3977
+
3978
+ func expandCloudBuildTriggerBuildStepAllowExitCodes (v interface {}, d TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3979
+ return v , nil
3980
+ }
3981
+
3929
3982
func expandCloudBuildTriggerBuildArtifacts (v interface {}, d TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3930
3983
l := v .([]interface {})
3931
3984
if len (l ) == 0 || l [0 ] == nil {
0 commit comments