Git Call
  • 16 Nov 2023
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Git Call

  • Dark
    Light
  • PDF

Article Summary

Overview

With the Git Call node, you can easily fetch and execute code from any Git repository, be it GitHub or any other platform. All you need to do is specify the needed repository, write a program that uses it (or include it in the repository), and give proper build instructions.

Experience with Git and the command line is recommended before you start working with the Git Call node.

When working with the Git Call node, don’t be afraid of the following:

  • If you're not a Git pro, the Git Call node is designed to be user-friendly and easy to work with. So, you can quickly and effectively access and execute code from any Git repository without much hassle.
  • The intricacies of the node's internal Processes may appear intimidating to those unfamiliar with Docker containerization, but you don't need to understand them to work with the Git Call node. All you need to know is that it works as a miniature computer that effectively executes your code.

Git Call schema

Settings

The Git Call node has the following parameters:

  1. (Optional) Title and Description: Name and details of the node.

  2. Basic settings:

    • Language: The following programming languages are supported with their Package Managers (PM) and OS:

      • JavaScript (node) v18.16; PM: yarn, npm; OS: alpine v3.17
      • GoLang v1.20; PM: go mod; OS: alpine v3.17
      • Python v.3.11.2; PM: pip; OS: alpine v3.17
      • PHP v8.1.16; PM: composer v2.5.4; OS: alpine v3.17
      • Java v19; PM: gradle; OS: alpine v3.15
      • Closure v1.11.1; PM: lein 2.10.0; OS: alpine v3.17
      • Lisp v2.0.5; PM: roswell v20.05.14.106; OS: Ubuntu v18.04.4
      • Prolog; PM: swipl v9.1.8; OS: debian:bullseye-slim
    • Code editor: You can easily incorporate your custom code with the existing codebase from the Git repository and execute it seamlessly as a part of the overall workflow, meaning:

      • js: usercode.js
      • go: usercode.go
      • python: usercode.py
      • php: usercode.php

      As another option, you can include the Usercode file in your Git repository, which allows you to manage and control versions of your custom code alongside the main codebase. If the file Usercode is already included in the Git repository, but you also write code in the Code editor, the original file will be overwritten.
      To correctly integrate and execute your custom code within the Git Call node, it must be written within a wrapper. You can find detailed examples of the appropriate wrapper syntax for each programming language on our GitHub page.

    • Get SSH key: Generates an SSH key that can be added to your private Git repository and automatically authenticates the node.

    • Repo URL: Indicates the URL of the Git repository that you will retrieve. If you choose to authenticate your request to access the repository with a username and password, you can do so by adding them to the URL in the following format:

      https://username:password@github.com/account/repository
      

      For security reasons, it is not recommended to include credentials in the URL. Instead, we suggest using an SSH key to authenticate your requests.

    • Tag Branch Commit: Indicates a specific branch from your repository; in most cases, it should be Main.

    • Handler (Java): The name of the class that implements UsercodeHandler.

    • (Optional) Build command: Commands to build your code and install any missing libraries by using Package Manager. It uses sh (Bourne Shell) and provides a non-interactive environment. After clicking Build, a terminal window opens, and you can monitor the execution of your commands. Unlike a typical terminal, you cannot interact with it, and you need to specify your commands together.
      Note: There is no access to the root repository.

  3. Other:

    • Alert if the number of tasks in the node queue reaches the following number: Helps monitor whether the number of tasks in the node exceeds the specified threshold. When selecting the checkbox, you have to enter the needed number of tasks in the field that appears below.
    • Maximum interval, for which the task stays in the node before being forwarded: The amount of time a task is allowed to be in the node; can be set in seconds, minutes, hours, and days.
      Note: The checkbox has a minimum value of 30 seconds. You can set a shorter interval by using the Unixtime function.

    GitCall settings

The Git Call node is different from other nodes in that every time you make a change, you’ll need to rebuild the node by clicking Build before deploying it.

Examples

Accessing the Python library
Below, you can see the example of the Git Call node used to install a library and write code that uses it.
Git Call node

When writing your code:

  • Place your code inside the handle function, which uses the data parameter containing the task parameters as an input.
  • Since Python represents JSON objects as dictionaries, use dictionary syntax when accessing and manipulating the task parameters within the data variable.

Error handling & troubleshooting

When an error occurs in the Git Call node, a task goes to the auxiliary Condition output node that is used for storing error parameters.

image.png

When an error occurs during the task processing, you may see the following error parameter names in the task.

Error parameter nameError type
__conveyor_git_call_return_type_error__Hardware (system error), Software (error in a node logic/settings).
__conveyor_git_call_return_type_tag__*Error tag.
__conveyor_git_call_return_type_description__Error description in human-readable language; can be static or dynamic.

*The error tag __conveyor_git_call_return_type_tag__ may have the following values.

ValueCauseSolution
git_call_return_format_errorIncorrect response format from the Git Call node.Contact the support team for further assistance.
git_call_executing_errorAn incorrect code has been returned from the Git Call node.Contact the support team for further assistance.
git_call_is_not_supportedThe Git Call node you are using has the version 1, which is no longer supported.Use the Git Call node version 2.
code_return_size_overflowThe size of your code exceeds the specified limit set for your environment.Reduce the size of your code.
git_call_fatal_errorA hardware error has occurred.Contact the support team for further assistance.

When working with your Process, you may encounter the following issues.

IssueCauseSolution
The build fails.To use the repository, root access is required.Corezoid does not permit access to the root directory. If your code requires root access, you need to modify it to work within the allowed directory structure or you can contact us to discuss custom solutions.
The repository requires C/C++.By default, Git Call does not support C/C++. If you need access to this feature, please contact our support team.
There is no internet access.Git Call requires internet access to retrieve code from an online repository. It doesn’t function in a closed offline environment.

Was this article helpful?

What's Next