Publish Function Compute FC applications
Flow deploys and publishes applications to Alibaba Cloud Function Compute (FC). You can deploy functions from ZIP code packages stored in Object Storage Service (OSS). FC is an event-driven and fully managed serverless compute service. You do not need to manage servers or other infrastructure. You only need to write and upload your code. FC prepares the compute resources and runs your code with elasticity and reliability.
Prerequisites
If you use the OSS source code type, you must complete the following preparations.
Ensure that you have created and configured an Object Storage Service (OSS) instance. For more information, see Create a bucket.
Ensure that you have created a function instance. Configure an event-triggered or HTTP-triggered function and set the code upload method to OSS. Function Compute provides multiple methods to upload code. You can choose a method based on your requirements. For more information, see Manage functions.
Step 1: Create a pipeline
Log on to the Flow console. In the upper-right corner, click New Pipeline.
In the dialog box, select a pipeline template. Click Create.
Step 2: Configure the pipeline to deploy to Function Compute
Add a task node. Click the Empty Task node. On the Edit page, configure the parameters.
Parameter |
Description |
Task Name |
Enter a custom name for the task. |
Build Cluster |
Select the default or a private build cluster region as needed. |
Build Environment |
Select a build environment as needed.
Note
During task execution, the pipeline build environment is allocated for your use. You have full permissions to the build environment and can customize the execution script. |
Download Pipeline Source |
Select a method as needed. |
In the Task Steps section, click Add Step on the right. From the pop-up menu, select Publish. Click Deploy to Alibaba Cloud Function Compute to add the task to the task steps.
Parameter |
Description |
Step Name |
Enter a custom name for the step. |
Select Service Connection |
Click Add Service Connection on the right. Grant Flow the permissions to access the FC service. Click Create to finish creating the service connection. |
Region |
Select the region where the target FC instance is located. |
Service Name |
Select the custom service name to which the target FC instance belongs. |
Function Name |
Select the name of the function in the target FC instance. |
Select a source code type. The parameters vary based on the source code type. Configure the parameters accordingly.
OSS ZIP file
Set the OSS Bucket parameter to the name of the destination bucket that you created.
Set the OSS Object Name parameter to the custom file path in the destination bucket.
NoteIn an OSS instance, the OSS Object Name is the relative path of the file, such as 'test/fc.zip'. You can use environment variables in the path.
Ensure that the .zip code package is uploaded to the OSS bucket.
Local code
Add a Pipeline Source task. For Code Source, select a code repository.
Set the Code Path parameter based on your environment. Enter a period (.) to indicate the current directory.
Step 3: Run and view the target pipeline job
In the Flow console, go to the My Pipelines list. Click the
Run button to the right of the target pipeline. Click the pipeline name to view the status of the task nodes.After the pipeline job is complete, on the task node for the Function Compute (FC) deployment, click Log in the lower-right corner to view the execution logs.