Build-free deployment

Updated at:

For projects that do not require a build or compilation step, Flow supports build-free deployment by synchronizing code directly from a Git repository to a host. This guide explains how to configure the process.

Step 1: Create a pipeline

  1. Log into the Flow console.

  2. On the My Pipelines page, click New Pipeline in the upper-right corner. On the Select a Pipeline Template page, select blank template · blank template, and click Create.

Step 2: Configure the pipeline source

  1. In the Pipeline Source stage, click Add Pipeline Source.

  2. Add a code source. Choose , and then click Add.

    The sample code is for demonstration only. In a production environment, use your own code source.

Step 3: Add the Get Git Version task

  1. Click New Task and select .

  2. Use the default configuration for the Get Git Version step.

    You can also customize the step name and artifact name. The artifact name distinguishes outputs from different builds, and deployment components reference this name.

Step 4: Configure host deployment

  1. Click New Task and select .

  2. In the Edit panel for the host deployment task, configure the following parameters and leave the others at their default settings. On the task configuration panel, set download path to /home/admin/app/package.tgz and execution user to root.

    • Artifact: Select the artifact name.

    • Host Group: Select the host group.

      Important

      Ensure the target host has Git and the code's runtime environment installed.

    • Deployment Script: This script pulls code to the host and runs deployment tasks. Configure it based on your project's requirements. The following is a simple example:

      echo ${GIT_REPO} 
      echo ${GIT_BRANCH}
      echo ${COMMIT_ID}
      # Create the deployment directory on the host and navigate into it
      mkdir -p /data/wwwroot && cd /data/wwwroot
      # Extract the Git repository path
      repo_path=$(echo "${GIT_REPO}" | sed 's#^https://##')
      # Use Git to pull the repository code on the host
      git clone https://$username:$password@${repo_path} -b ${GIT_BRANCH}
      • The Get Git Version step provides the variables GIT_REPO (Git URL), GIT_BRANCH (Git branch name), and COMMIT_ID (commit ID).

      • The username and password are the credentials for your Git repository. For better security, store them as environment variables.

Step 5: Run the pipeline

  1. In the pipeline editor, click Save and Run in the upper-right corner. In the confirmation dialog box, click Run.

  2. Flow generates a separate log for each task. Click Log on a task card to view detailed runtime information.