GitLab v8.11.0 published on Friday, Apr 18, 2025 by Pulumi
gitlab.getRepositoryTree
Explore with Pulumi AI
The gitlab.getRepositoryTree data source allows details of directories and files in a repository to be retrieved.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const _this = gitlab.getRepositoryTree({
    project: "example",
    ref: "main",
    path: "ExampleSubFolder",
    recursive: true,
});
import pulumi
import pulumi_gitlab as gitlab
this = gitlab.get_repository_tree(project="example",
    ref="main",
    path="ExampleSubFolder",
    recursive=True)
package main
import (
	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gitlab.GetRepositoryTree(ctx, &gitlab.GetRepositoryTreeArgs{
			Project:   "example",
			Ref:       "main",
			Path:      pulumi.StringRef("ExampleSubFolder"),
			Recursive: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() => 
{
    var @this = GitLab.GetRepositoryTree.Invoke(new()
    {
        Project = "example",
        Ref = "main",
        Path = "ExampleSubFolder",
        Recursive = true,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetRepositoryTreeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var this = GitlabFunctions.getRepositoryTree(GetRepositoryTreeArgs.builder()
            .project("example")
            .ref("main")
            .path("ExampleSubFolder")
            .recursive(true)
            .build());
    }
}
variables:
  this:
    fn::invoke:
      function: gitlab:getRepositoryTree
      arguments:
        project: example
        ref: main
        path: ExampleSubFolder
        recursive: true
Using getRepositoryTree
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRepositoryTree(args: GetRepositoryTreeArgs, opts?: InvokeOptions): Promise<GetRepositoryTreeResult>
function getRepositoryTreeOutput(args: GetRepositoryTreeOutputArgs, opts?: InvokeOptions): Output<GetRepositoryTreeResult>def get_repository_tree(path: Optional[str] = None,
                        project: Optional[str] = None,
                        recursive: Optional[bool] = None,
                        ref: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetRepositoryTreeResult
def get_repository_tree_output(path: Optional[pulumi.Input[str]] = None,
                        project: Optional[pulumi.Input[str]] = None,
                        recursive: Optional[pulumi.Input[bool]] = None,
                        ref: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetRepositoryTreeResult]func GetRepositoryTree(ctx *Context, args *GetRepositoryTreeArgs, opts ...InvokeOption) (*GetRepositoryTreeResult, error)
func GetRepositoryTreeOutput(ctx *Context, args *GetRepositoryTreeOutputArgs, opts ...InvokeOption) GetRepositoryTreeResultOutput> Note: This function is named GetRepositoryTree in the Go SDK.
public static class GetRepositoryTree 
{
    public static Task<GetRepositoryTreeResult> InvokeAsync(GetRepositoryTreeArgs args, InvokeOptions? opts = null)
    public static Output<GetRepositoryTreeResult> Invoke(GetRepositoryTreeInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRepositoryTreeResult> getRepositoryTree(GetRepositoryTreeArgs args, InvokeOptions options)
public static Output<GetRepositoryTreeResult> getRepositoryTree(GetRepositoryTreeArgs args, InvokeOptions options)
fn::invoke:
  function: gitlab:index/getRepositoryTree:getRepositoryTree
  arguments:
    # arguments dictionaryThe following arguments are supported:
getRepositoryTree Result
The following output properties are available:
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Project string
 - The ID or full path of the project owned by the authenticated user.
 - Ref string
 - The name of a repository branch or tag.
 - Trees
List<Pulumi.
Git Lab. Outputs. Get Repository Tree Tree>  - The list of files/directories returned by the search
 - Path string
 - The path inside repository. Used to get content of subdirectories.
 - Recursive bool
 - Boolean value used to get a recursive tree (false by default).
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Project string
 - The ID or full path of the project owned by the authenticated user.
 - Ref string
 - The name of a repository branch or tag.
 - Trees
[]Get
Repository Tree Tree  - The list of files/directories returned by the search
 - Path string
 - The path inside repository. Used to get content of subdirectories.
 - Recursive bool
 - Boolean value used to get a recursive tree (false by default).
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - project String
 - The ID or full path of the project owned by the authenticated user.
 - ref String
 - The name of a repository branch or tag.
 - trees
List<Get
Repository Tree Tree>  - The list of files/directories returned by the search
 - path String
 - The path inside repository. Used to get content of subdirectories.
 - recursive Boolean
 - Boolean value used to get a recursive tree (false by default).
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - project string
 - The ID or full path of the project owned by the authenticated user.
 - ref string
 - The name of a repository branch or tag.
 - trees
Get
Repository Tree Tree[]  - The list of files/directories returned by the search
 - path string
 - The path inside repository. Used to get content of subdirectories.
 - recursive boolean
 - Boolean value used to get a recursive tree (false by default).
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - project str
 - The ID or full path of the project owned by the authenticated user.
 - ref str
 - The name of a repository branch or tag.
 - trees
Sequence[Get
Repository Tree Tree]  - The list of files/directories returned by the search
 - path str
 - The path inside repository. Used to get content of subdirectories.
 - recursive bool
 - Boolean value used to get a recursive tree (false by default).
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - project String
 - The ID or full path of the project owned by the authenticated user.
 - ref String
 - The name of a repository branch or tag.
 - trees List<Property Map>
 - The list of files/directories returned by the search
 - path String
 - The path inside repository. Used to get content of subdirectories.
 - recursive Boolean
 - Boolean value used to get a recursive tree (false by default).
 
Supporting Types
GetRepositoryTreeTree   
- Id string
 - The SHA-1 hash of the tree or blob in the repository.
 - Mode string
 - Unix access mode of the file in the repository.
 - Name string
 - Name of the blob or tree in the repository
 - Path string
 - Path of the object inside of the repository.
 - Type string
 - Type of object in the repository. Can be either type tree or of type blob
 
- Id string
 - The SHA-1 hash of the tree or blob in the repository.
 - Mode string
 - Unix access mode of the file in the repository.
 - Name string
 - Name of the blob or tree in the repository
 - Path string
 - Path of the object inside of the repository.
 - Type string
 - Type of object in the repository. Can be either type tree or of type blob
 
- id String
 - The SHA-1 hash of the tree or blob in the repository.
 - mode String
 - Unix access mode of the file in the repository.
 - name String
 - Name of the blob or tree in the repository
 - path String
 - Path of the object inside of the repository.
 - type String
 - Type of object in the repository. Can be either type tree or of type blob
 
- id string
 - The SHA-1 hash of the tree or blob in the repository.
 - mode string
 - Unix access mode of the file in the repository.
 - name string
 - Name of the blob or tree in the repository
 - path string
 - Path of the object inside of the repository.
 - type string
 - Type of object in the repository. Can be either type tree or of type blob
 
- id String
 - The SHA-1 hash of the tree or blob in the repository.
 - mode String
 - Unix access mode of the file in the repository.
 - name String
 - Name of the blob or tree in the repository
 - path String
 - Path of the object inside of the repository.
 - type String
 - Type of object in the repository. Can be either type tree or of type blob
 
Package Details
- Repository
 - GitLab pulumi/pulumi-gitlab
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
gitlabTerraform Provider.