Dagger
Search

git

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.

The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.

Installation

dagger install github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca

Entrypoint

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Git repository directory (must include .git)
imageRegistryString "docker.io"Git image registry
imageRepositoryString "alpine/git"Git image repositroy
imageTagString "2.52.0"Git image tag
userIdString "65532"Git image user
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
func (m *MyModule) Example() *dagger.Git  {
	return dag.
			Git()
}
@function
def example() -> dagger.Git:
	return (
		dag.git()
	)
@func()
example(): Git {
	return dag
		.git()
}

Types

Git 🔗

container() 🔗

Creates container with configured git

Return Type
Container !
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Git().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.git()
		.container()
	)
@func()
example(): Container {
	return dag
		.git()
		.container()
}

fetchTags() 🔗

Fetch tags from remote.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
remoteString !"origin"Remote name to fetch tags from
pruneBoolean falsePrune deleted tags
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 fetch-tags --remote string
func (m *MyModule) Example(ctx context.Context, remote string) string  {
	return dag.
			Git().
			FetchTags(ctx, remote)
}
@function
async def example(remote: str) -> str:
	return await (
		dag.git()
		.fetch_tags(remote)
	)
@func()
async example(remote: string): Promise<string> {
	return dag
		.git()
		.fetchTags(remote)
}

getChangedPaths() 🔗

Return changed paths inside diff_path between target_branch and HEAD

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
targetBranchString !"master"Target branch or ref to diff against
diffPathString "."Path to scope the diff (relative to repo root)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 get-changed-paths --target-branch string
func (m *MyModule) Example(ctx context.Context, targetBranch string) []string  {
	return dag.
			Git().
			GetChangedPaths(ctx, targetBranch)
}
@function
async def example(target_branch: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_paths(target_branch)
	)
@func()
async example(targetBranch: string): Promise<string[]> {
	return dag
		.git()
		.getChangedPaths(targetBranch)
}

getShortCommitSha() 🔗

Return short commit SHA for HEAD

Return Type
String !
Arguments
NameTypeDefault ValueDescription
lengthInteger 8Length of the short SHA
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 get-short-commit-sha
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Git().
			GetShortCommitSha(ctx)
}
@function
async def example() -> str:
	return await (
		dag.git()
		.get_short_commit_sha()
	)
@func()
async example(): Promise<string> {
	return dag
		.git()
		.getShortCommitSha()
}

getTags() 🔗

Return tags in the repository, optionally filtered by glob pattern.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 get-tags --pattern string
func (m *MyModule) Example(ctx context.Context, pattern string) []string  {
	return dag.
			Git().
			GetTags(ctx, pattern)
}
@function
async def example(pattern: str) -> List[str]:
	return await (
		dag.git()
		.get_tags(pattern)
	)
@func()
async example(pattern: string): Promise<string[]> {
	return dag
		.git()
		.getTags(pattern)
}

getTagsPointingAt() 🔗

Fetch tags and return tags that point at a ref.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
refString !"HEAD"Git ref to inspect
remoteString !"origin"Remote name to fetch tags from
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 get-tags-pointing-at --ref string --remote string
func (m *MyModule) Example(ctx context.Context, ref string, remote string) []string  {
	return dag.
			Git().
			GetTagsPointingAt(ctx, ref, remote)
}
@function
async def example(ref: str, remote: str) -> List[str]:
	return await (
		dag.git()
		.get_tags_pointing_at(ref, remote)
	)
@func()
async example(ref: string, remote: string): Promise<string[]> {
	return dag
		.git()
		.getTagsPointingAt(ref, remote)
}

listTags() 🔗

Compatibility wrapper for get_tags.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 list-tags --pattern string
func (m *MyModule) Example(ctx context.Context, pattern string) []string  {
	return dag.
			Git().
			ListTags(ctx, pattern)
}
@function
async def example(pattern: str) -> List[str]:
	return await (
		dag.git()
		.list_tags(pattern)
	)
@func()
async example(pattern: string): Promise<string[]> {
	return dag
		.git()
		.listTags(pattern)
}

withSshPrivateKey() 🔗

Add ssh private key to container

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceFile !-Private key file
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
 with-ssh-private-key --source file:path
func (m *MyModule) Example(ctx context.Context, source *dagger.File) string  {
	return dag.
			Git().
			WithSshPrivateKey(ctx, source)
}
@function
async def example(source: dagger.File) -> str:
	return await (
		dag.git()
		.with_ssh_private_key(source)
	)
@func()
async example(source: File): Promise<string> {
	return dag
		.git()
		.withSshPrivateKey(source)
}