Getting Script from Git


This topic introduces how to pull script files from Git for editing and debugging, and then push the script files to Git for script version management.

Before You Start

  • Prepare script files and save them to the Git project.

  • Register the GitLab data source through Data Source Registration. For details, see Registering a GitLab Data Source.

Getting Script from Git

Take the following steps to create script by pulling script file for Git.

  1. Log in EnOS Management Console and select Batch Data Processing > Scripts from the left navigation menu. Then, click + above the script list or click Create Script in the blank page to create script.

  2. In the New Script window, complete the following settings, and click Create.

    • Type: Select the script type (supporting Hive SQL and Shell scripts)

    • Directory: Select the directory to store the script file

    • Method: Select Get from Git

    • Git Dir Structure: Select whether to reserve the Git directory structure (Not Reserve: the pulled files must not have the same name; Reserve: the pulled files have Git direcotory reserved)

    • Git Source / Project / Branch: Select the Git data source, Git project name, and Git branch. Navigate and select the script files to be pulled.

    ../_images/adding_script_from_git.png
  3. View the pulled script files, edit the script in the editor, and click Save.

    ../_images/added_script_from_git.png
  4. After editing the script file, you can run the script and view the running result. For details, see Running Script.

Uploading Script

After running and debugging the script, you can push the script files to the Git project.

  1. In the script file directory, right-click the script name, and select Upload.

    ../_images/upload_script_to_git_1.png
  2. In the pop-up window, select the Git data source, Git project name, Git branch, and the directory of the script file. Click OK to upload the script file.

    ../_images/upload_script_to_git_2.png

Updating Script

When script files in the Git project are changed, you can update the script files by the following steps:

  1. In the script file directory, right-click the script name, and select Update.

    ../_images/refresh_script.png
  2. In the pop-up window, select the Git data source, Git project name, Git branch, Git directory, and the changed script files. Click OK to update the script files quickly.