git
This module has been generated via dagger init and serves as a reference tobasic 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@875bc512cdced2a013cfbbe891ea858f710129caEntrypoint
Return Type
Git !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Git repository directory (must include .git) |
| imageRegistry | String | "docker.io" | Git image registry |
| imageRepository | String | "alpine/git" | Git image repositroy |
| imageTag | String | "2.52.0" | Git image tag |
| userId | String | "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 \
containerfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| remote | String ! | "origin" | Remote name to fetch tags from |
| prune | Boolean | false | Prune deleted tags |
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
fetch-tags --remote stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| targetBranch | String ! | "master" | Target branch or ref to diff against |
| diffPath | String | "." | 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 stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| length | Integer | 8 | Length of the short SHA |
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
get-short-commit-shafunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| pattern | String ! | "*" | Optional tag filter pattern (glob) |
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
get-tags --pattern stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| ref | String ! | "HEAD" | Git ref to inspect |
| remote | String ! | "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 stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| pattern | String ! | "*" | Optional tag filter pattern (glob) |
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
list-tags --pattern stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | File ! | - | Private key file |
Example
dagger -m github.com/riftonix/daggerverse/modules/git@875bc512cdced2a013cfbbe891ea858f710129ca call \
with-ssh-private-key --source file:pathfunc (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)
}