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

YAML

steps:
  step-name:
    type: git-clone
    clone_dir: sub/folder/
ParameterDescriptionRequired
typeThe type of the Microtica built-in step.
Should always be git-clone for this type of step.
Yes
clone_dirPath to where the source code should be cloned.
If not provided, the source code will be cloned in the current working dir of the pipeline runtime environment.
No

#Clone a source code from a Git repository

When using the built-in step Git Clone, the Git account and repository provided while creating the pipeline will be automatically used in the step.

Create new pipeline

In the following example, the Clone step will clone the master branch from microtica/app repository hosted on Microtica Git account.

So, if you run ls -l command in the next step you should be able to see the content of the source code root dir.

microtica.yaml

steps:
  Clone:
    type: git-clone
  ListContent:
    image: alpine:latest
    commands:
      - ls -l

#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

steps:
  Clone:
    type: git-clone
    clone_dir: sub/folder
  ListContent:
    image: alpine:latest
    commands:
      - cd sub/folder
      - ls -l

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.