This topic shows you how to use Serverless Devs in the Apsara Devops Flow console to deploy a function to Function Compute.
- Activate Function Compute.
- Activate Flow.
- Upload your business code to a code repository.
- For more information about the types of code repositories that are supported by Flow, see Configure a source code repository.
- In addition to your business code, you must also add the template.yml file for Funcraft and the s.yml file for Serverless Devs to the code repository. You can use the following configuration in the s.yml file:
ProjectName: Component: fun Provider: alibaba Properties: Region: cn-qingdao #The region where you want to deploy a function. Config: s
- Log on to the Flow console.
- In the upper-right corner of the My Pipelines page, click Create Pipeline.
- In the Select a pipeline template dialog box, select Empty Template in the Others section and click Create.
- In the Add Pipeline Source panel, select a code repository type, specify the code repository that you want to use and the default branch, and then click Add.
- In the Phase 1 section of the Process Configuration tab, click Empty Task. In the Edit panel, set the parameters as required.
- Click Save and Run in the upper-right corner. In the Confirm message, click OK to run the pipeline.After you click OK, the Recently Run tab appears. If the pipeline enters the Successful state, the function is deployed to Function Compute.
Problem description: I have used a third-party cloud service or configured a trigger for a function. What can I do if I fail to use Flow to deploy the function to Function Compute?
Cause: The AliyunRDCDefaultRole RAM role that is assumed by Flow has limited permissions. Therefore, Flow may fail to deploy a function to Function Compute in the following scenarios:
|Scenario||Required permission and its feature|
|No specific RAM role is assumed by the function and a third-party cloud service is involved in the function configuration.||
|A trigger is configured for the function. Function Compute supports the following types of triggers: Object Storage Service (OSS) event trigger, Message Service (MNS) topic trigger, Log Service trigger, Tablestore trigger, CDN event trigger, API Gateway trigger, and Cloud Monitor trigger.||The read permissions or full access permissions on the Alibaba Cloud service involved: ensures that resources of the Alibaba Cloud service can be accessed when trigger resources are being created.|
- Log on to the RAM console and attach the required permission policy to the AliyunRDCDefaultRole RAM role.
Notice This method is applicable if you use an Alibaba Cloud account or a RAM user that is authorized to modify the permissions of a RAM role.
- Configure Serverless Devs by using an Alibaba Cloud account or a RAM user that has sufficient permissions. For more information about the procedure, see Key configuration.