Help Center/ FunctionGraph/ Developer Guide/ Automated Deployment/ Hosting Function Code with CodeArts/ Step 4: Set Up a Pipeline for Updating the Function Deployment Script
Updated on 2025-12-10 GMT+08:00

Step 4: Set Up a Pipeline for Updating the Function Deployment Script

The pipeline allows you to release the function deployment script deploy.py to the deployment host for function updates.

Creating a Build Task

  1. Log in to the CodeArts console, choose CodeArts Build in the navigation pane, and click Go to CodeArts Build.
  2. On the Build page, click Create Task. Set basic information by referring to Figure 1 and click Next.
    Figure 1 Creating a build task

  3. Select Blank Template and click OK.
  4. Click the Parameters tab, add the codeBranch and releaseVersion parameters inCustom page, and enable Runtime Settings.
    Figure 2 Configuring the version parameter

  5. Click the Build Actions tab, click Add Build Actions, and select Upload to Release Repo. The Upload to Release Repo action is displayed in the left pane.
  6. Click the Upload to Release Repo action, and set parameters.
    Figure 3 Setting parameters

    • Action Name: Enter Upload to Release Repo.
    • Package Location: Enter deploy/deploy.py.
    • Version: Enter ${releaseVersion}.

Creating a Deployment Task

  1. Return to the CodeArts console. In the navigation pane, choose Deploy. Click Create Application.
  2. On the Basic Information tab page, set the application basic information. Set Name to update-function-deploy, retain the default values for other parameters, and click Next.
  3. Select Blank Template and click OK.
  4. On the Deployment Actions tab page, add Select Deployment Source.
  5. Set Source to Artifact and configure the deployment source.
    • Environment: Select the host cluster deploy-function.
    • Software Package: Enter /functions-deploy-build/${releaseVersion}/deploy.py.
    • Download Path: Enter /home/function/deploy.
  6. Click the Parameters tab, add the codeBranch and releaseVersion parameters inCustom page, and enable Runtime Settings.
    Figure 4 Configuring the version parameter

Configuring a Pipeline

  1. Return to the CodeArts console. In the navigation pane, choose CodeArts Pipeline. Click Go to CodeArts Pipeline.
  2. Access the pipeline console and click Create Pipeline.
  3. On the Basic Information page, set the pipeline name to pipeline-update-function-deploy, set other parameters by referring to Figure 5, and click Next.
    Figure 5 Creating a pipeline

  4. Configure Build and Check.
    1. Add a build task, and select the function-deploy-build task.
      Figure 6 Adding a task
    2. Set releaseVersion as a pipeline parameter.
      Figure 7 Setting releaseVersion
    3. Click Save.
  5. Configure a deployment task.
    1. Add a stage named Deploy after Build_and_Check, set Task Execution to Serial, and click Save.
      Figure 8 Configuring the stage
    2. Click Add Task to add a deployment task named DeployScript, and select the update-function-deploy task.
      Figure 9 Adding a task
      Figure 10 Configuring the task
      Set releaseVersion as a pipeline parameter.
      Figure 11 Setting releaseVersion
    3. Click Save.
  6. On the Basic Information tab page, change the pipeline task name to pipeline-update-function-deploy and click Save.
  7. Execute the pipeline.
    1. Set the runtime parameter releaseVersion to 1.0.0 and click Execute.
    2. Wait till the deploy.py script is released.
      Figure 12 Execution successful