@@ -75,9 +75,11 @@ tasks:
7575 help : <description>
7676 args : <arguments>
7777 env : <environment_variables>
78- hooks : <pre/post-run_hooks >
78+ hooks : <pre-run /post-run/failure_hooks >
7979 matrix : <parameter_combinations>
8080 log : <file_logging_configuration>
81+ if : <validation_conditionals>
82+ options : <additional_options>
8183 run : <command>
8284{% endraw %}
8385```
@@ -103,8 +105,8 @@ tasks:
103105
104106### Description
105107
106- Defines arguments that tasks can accept with types, defaults, and help
107- descriptions .
108+ Defines arguments that tasks can accept with types, defaults,help descriptions
109+ and validation options .
108110
109111### Structure
110112
@@ -115,16 +117,27 @@ args:
115117 default : <default_value>
116118 interactive : <true/false>
117119 help : <description>
120+ validations :
121+ <validation-type> : <validation_value>
118122` ` `
119123
124+ > You can provide ` validation-type` options similar to
125+ > [JSON schema validation options](https://json-schema.org/draft/2020-12/json-schema-validation#name-validation-keywords-for-num)
126+
120127# ## Example
121128
122129` ` ` yaml
123130args:
124131 env:
125- type : str
132+ type: string
126133 default: "dev"
127134 help: Environment setting
135+ username:
136+ type: string
137+ help: Username for system access
138+ validations:
139+ min-length: 3
140+ max-length: 32
128141` ` `
129142
130143---
@@ -134,8 +147,8 @@ args:
134147# ## Description
135148
136149Hooks define tasks that run before (`pre-run`) or after (`post-run`) a task
137- executes. They can also include an `if` condition to control when the hook
138- should be triggered.
150+ executes or after (`failure`) a task execution fails. They can also include an
151+ ` if ` condition to control when the hook should be triggered.
139152
140153# ## Structure
141154
@@ -147,6 +160,9 @@ hooks:
147160 post-run:
148161 - task: <task_name>
149162 if: <condition>
163+ failure:
164+ - task: <task_name>
165+ if: <condition>
150166` ` `
151167
152168# ## Example
@@ -161,6 +177,8 @@ tasks:
161177 if: ${{ vars.REBUILD == "true" }}
162178 post-run:
163179 - task: notify
180+ failure:
181+ - task: failure-notify
164182 run: echo "Building project..."
165183{% endraw %}
166184` ` `
@@ -397,7 +415,54 @@ tasks:
397415
398416---
399417
400- # # 12. Variables
418+ # # 12. Ignore Error Option
419+
420+ # ## Description
421+
422+ The `ignore-errors` option allows a task to continue executing subsequent tasks
423+ even if it fails. When `ignore-errors : true` is set under `options`, the failure
424+ of that task does not interrupt the execution flow.
425+
426+ # ## Structure
427+
428+ ` ` ` yaml
429+ options:
430+ ignore-errors: <true/false>
431+ ` ` `
432+
433+ > The default value for `ignore-errors` is set to `false`
434+
435+ # ## Example
436+
437+ ` ` ` yaml
438+ groups:
439+ deploy:
440+ tasks:
441+ clear-cache:
442+ help: Attempt to clear CDN cache (optional)
443+ options:
444+ ignore-errors: true
445+ run: |
446+ echo "Clearing CDN cache..."
447+ # Simulate possible failure
448+ assert 1 == 2
449+
450+ deploy-app:
451+ help: Deploy the application
452+ run: echo "Deploying application to production..."
453+
454+ main-deploy:
455+ help: Deployment pipeline
456+ hooks:
457+ pre-run:
458+ - task: deploy.clear-cache
459+ - task: deploy.deploy-app
460+ run: echo "Deployment complete."
461+ ` ` `
462+
463+ ---
464+
465+ # # 13. Variables
401466
402467# ## Description
403468
@@ -434,7 +499,7 @@ tasks:
434499{% endraw %}
435500` ` `
436501
437- # # 13 . Environment Variables
502+ # # 14 . Environment Variables
438503
439504# ## Description
440505
0 commit comments