This topic describes how to create a workflow that contains a Pass state by using the CloudFlow console and Alibaba Cloud Command Line Interface (CLI).
The CloudFlow console
The Create Flow with Code method is used in this example.
Log on to the CloudFlow console.
In the top navigation bar, select a region.
On the Flows page, click Create flow.
On the Create Flow page, click Create Flow with Code and configure the parameters.
NoteThe Hello World and Sample Projects methods can also be used to create a flow. However, you cannot modify Definition if one of these methods is used to create a flow.
Name: Enter a name for the flow. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It cannot start with a hyphen (-).
Description (Optional): Enter a description for the flow.
Definition: Follow the visual process to set a flow definition.
You must change the content in the YAML file of Definition to the following code:
version: v1 type: flow steps: - type: pass name: pass1
The following table describes the parameters included in the code.
Operation
Description
version
The version of the flow. Only
v1
is supported.type
The type of the flow. Default value:
flow
.steps
The steps in the flow.
type
pass
: The type of the step. For more information, see Overview.name
The name of the step. You can specify a step name.
Click Next Step.
Configure a flow role.
NoteIf other cloud services such as Function Compute need to be called in your flow, you can grant Serverless Workflow the permission to call other cloud services by adding RAM roles to the Config Flow Role section. In this example, yon can skip this step because the flow does not need to call other cloud services. For more information, see Create execution roles.
If you have created RAM roles, you can click Select an existing RAM role.
If you are using Serverless Workflow for the first time, you can create a RAM role by performing the following operations:
In the Config Flow Role section, click Create a RAM role. Enter a value in the Role Name field.
Select AliyunFCInvocationAccess from the System Policies drop-down list and click Create Role.
On the Role Templates page, click Confirm Authorization Policy.
On the Create Flow page, click Create Flow.
After the flow is created, the following page appears.
Alibaba Cloud CLI
You must install and configure Alibaba Cloud CLI Before you use it. For more information, see Installation guide and Configure Alibaba Cloud CLI.
# Help
aliyun fnf CreateFlow help
Expected output:
Alibaba Cloud CLI 3.0.57
Product: fnf (FunctionFlow)
Link: https://xxxxx.CreateFlow.html
Parameters:
--Definition String Required
--Description String Required
--Name String Required
--Type String Required
--ExternalStorageLocation String Optional
--RequestId String Optional
--RoleArn String Optional
You can use the CreateFlow command to create a workflow.
Make a preparation. You can store the following workflow definition in a file in the current path.
version: v1 type: flow steps: - type: pass name: pass1
Create a workflow.
ImportantYou must replace
RoleArn
in the following content by using your workflow role. For more information about workflow roles, see Create execution roles.aliyun fnf CreateFlow --Description "demo" --Type FDL --RoleArn acs:ram::xxx:xxx --Name cli_guide_1 --Definition "$(<./flow.yaml)"
Expected output:
# The execution result of the command { "Name": "cli_guide_1", "Description": "demo", "Definition": "version: v1\ntype: flow\nsteps:\n - type: pass\n name: pass1 ", "Id": "47ced55d-590b-482a-975f-915ac2365ad6", "Type": "FDL", "RoleArn": "acs:ram::xxx:xxx", "CreatedTime": "2024-06-24T02:31:43.359Z", "LastModifiedTime": "2024-06-24T02:31:43.359Z", "ExecutionMode": "Standard", "RequestId": "88aa74ff-1716-7680-965e-e0d893739bb0" }