Version: v1.1

Built-in Steps

This documentation will walk through the built-in workflow steps that you can use to design an application deployment process.

apply-application

Overview

Apply all components and traits in Application.

Parameter

No arguments, used for custom steps before or after application applied.

Example

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: express-server
  22. type: apply-application

depends-on-app

Overview

Wait for the specified Application to complete.

Parameter

NameTypeDescription
namestringThe name of the Application
namespacestringThe namespace of the Application

Example

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: express-server
  22. type: depends-on-app
  23. properties:
  24. name: another-app
  25. namespace: default

deploy2env

Overview

Apply Application in different policies and envs.

Parameter

NameTypeDescription
policystringThe name of the policy
envstringThe name of the env

Example

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: multi-env-demo
  5. namespace: default
  6. spec:
  7. components:
  8. - name: nginx-server
  9. type: webservice
  10. properties:
  11. image: nginx:1.21
  12. port: 80
  13. policies:
  14. - name: env
  15. type: env-binding
  16. properties:
  17. created: false
  18. envs:
  19. - name: test
  20. patch:
  21. components:
  22. - name: nginx-server
  23. type: webservice
  24. properties:
  25. image: nginx:1.20
  26. port: 80
  27. placement:
  28. namespaceSelector:
  29. name: test
  30. - name: prod
  31. patch:
  32. components:
  33. - name: nginx-server
  34. type: webservice
  35. properties:
  36. image: nginx:1.20
  37. port: 80
  38. placement:
  39. namespaceSelector:
  40. name: prod
  41. workflow:
  42. steps:
  43. - name: deploy-test-server
  44. type: deploy2env
  45. properties:
  46. policy: env
  47. env: test
  48. - name: deploy-prod-server
  49. type: deploy2env
  50. properties:
  51. policy: env
  52. env: prod

webhook-notification

Overview

Send messages to the webhook address.

Parameters

NameTypeDescription
slackObjectOptional, please fulfill its url and message if you want to send Slack messages
slack.urlStringRequired, the webhook address of Slack
slack.messageObjectRequired, the Slack messages you want to send, please follow Slack messaging
dingdingObjectOptional, please fulfill its url and message if you want to send DingTalk messages
dingding.urlStringRequired, the webhook address of DingTalk
dingding.messageObjectRequired, the DingTalk messages you want to send, please follow DingTalk messaging

Example

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: dingtalk-message
  22. type: webhook-notification
  23. properties:
  24. dingding:
  25. # the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
  26. url: xxx
  27. message:
  28. msgtype: text
  29. text:
  30. context: Workflow starting...
  31. - name: application
  32. type: apply-application
  33. - name: slack-message
  34. type: webhook-notification
  35. properties:
  36. slack:
  37. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  38. url: xxx
  39. message:
  40. text: Workflow ended.

suspend

Overview

Suspend the current workflow, we can use vela workflow resume appname to resume the suspended workflow.

For more information of vela workflow, please refer to vela cli

Parameter

NameTypeDescription
---

Example

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: slack-message
  22. type: webhook-notification
  23. properties:
  24. slack:
  25. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  26. message:
  27. text: Ready to apply the application, ask the administrator to approve and resume the workflow.
  28. - name: manual-approval
  29. type: suspend
  30. - name: express-server
  31. type: apply-application