16min

Git Clone

Clone a Git repository into pipeline runtime environment.

Git account and repository should be provided while creating a pipeline. The account and the repository will be automatically used in the Git Clone step while executing the pipeline.

Git Clone step uses Git accounts connected within Microtica Portal to obtain temporary access credentials.

Git credentials

Credentials for the specified Git repository will be automatically provided by Microtica.

Syntax

microtica.yaml
|

Parameter

Description

Required

title
The display name of the step.
No
type
The type of the Microtica built-in step. Should always be git-clone for this type of step.
Yes
clone_dir
Path to where the source code should be cloned. Default: . Current working dir of the pipeline runtime environment.
No
ssh_key
Provide a private SSH key to be used when cloning the source code from Git repository. The key should be provided in base64 format. You can encode the private key in base64 format using the following command where id_rsa is your private key: cat ~/.ssh/id_rsa | base64 Default: null
No
clone_submodules
Clone all submodules recursively for a given Git repository. Default: false
No

Clone into sub directory

By default the source code will be cloned in the current working dir of the pipeline runtime environment. If you need to store the code in a different directory you can achieve that by using clone_dir parameter.

microtica.yaml
|

So, if you navigate to sub/folder and run ls -l command in the next step you should be able to see the content of the source code root dir. Use an SSH key with Git

If you prefer to use an SSH key to access the Git repository you can achieve this by providing your SSH key as pipeline sensitive environment variable with key ssh_key.

To encode the private key in base64 format use the following command where id_rsa is your private key:

Shell
|

Copy and paste the encoded key into pipeline variable. You can find the environment varibales in Resource/App settings under Git.

Security consideration

Please make sure that you enable Sensitive option for the SSH key environment variable. This way the value will be stored and processed in a secure storage instead of plain value.

If you want to use a different environment variable key then ssh_key you can do that by using a step parameter and reference the pipeline environment variable. Below is an example step specification:

microtica.yaml
|

Where MY_SSH_KEY_ENV_VAR is the environment variable key defined in the Microtica pipeline.

ÔĽŅ

Updated 07 Jun 2022
Did this page help?
Yes
No