Dagger
Search

git-module

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/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604

Entrypoint

Return Type
GitModule !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-The source
baseContainerContainer -base container
ciString -The CI type It permit to set the right commiter or right message to avoid loop on CI
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH
func (m *myModule) example(src *Directory) *GitModule  {
	return dag.
			GitModule(src)
}
@function
def example(src: dagger.Directory, ) -> dag.GitModule:
	return (
		dag.git_module(src)
	)
@func()
example(src: Directory, ): GitModule {
	return dag
		.gitModule(src)
}

Types

GitModule 🔗

ci() 🔗

Return Type
String !
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH ci
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			Ci(ctx)
}
@function
async def example(src: dagger.Directory, ) -> str:
	return await (
		dag.git_module(src)
		.ci()
	)
@func()
async example(src: Directory, ): Promise<string> {
	return dag
		.gitModule(src)
		.ci()
}

container() 🔗

Return Type
Container !
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH container
func (m *myModule) example(src *Directory) *Container  {
	return dag.
			GitModule(src).
			Container()
}
@function
def example(src: dagger.Directory, ) -> dagger.Container:
	return (
		dag.git_module(src)
		.container()
	)
@func()
example(src: Directory, ): Container {
	return dag
		.gitModule(src)
		.container()
}

getCurrentBranchName() 🔗

GetCurrentBranchName Get the current branch name

Return Type
String !
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH get-current-branch-name
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			GetCurrentBranchName(ctx)
}
@function
async def example(src: dagger.Directory, ) -> str:
	return await (
		dag.git_module(src)
		.get_current_branch_name()
	)
@func()
async example(src: Directory, ): Promise<string> {
	return dag
		.gitModule(src)
		.getCurrentBranchName()
}

getCurrentUrl() 🔗

GetCurrentUrl get the origin URL

Return Type
String !
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH get-current-url
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			GetCurrentUrl(ctx)
}
@function
async def example(src: dagger.Directory, ) -> str:
	return await (
		dag.git_module(src)
		.get_current_url()
	)
@func()
async example(src: Directory, ): Promise<string> {
	return dag
		.gitModule(src)
		.getCurrentUrl()
}

withCustomContainer() 🔗

WithCustomContainer set a custom container It need to derive from the current container

Return Type
GitModule !
Arguments
NameTypeDefault ValueDescription
cContainer !-No description provided
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH with-custom-container --c IMAGE:TAG
func (m *myModule) example(src *Directory, c *Container) *GitModule  {
	return dag.
			GitModule(src).
			WithCustomContainer(c)
}
@function
def example(src: dagger.Directory, c: dagger.Container) -> dag.GitModule:
	return (
		dag.git_module(src)
		.with_custom_container(c)
	)
@func()
example(src: Directory, c: Container): GitModule {
	return dag
		.gitModule(src)
		.withCustomContainer(c)
}

setConfig() 🔗

SetConfig permit to set git config

Return Type
GitModule !
Arguments
NameTypeDefault ValueDescription
usernameString -The git username
emailString -The git email
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH set-config
func (m *myModule) example(src *Directory) *GitModule  {
	return dag.
			GitModule(src).
			SetConfig()
}
@function
def example(src: dagger.Directory, ) -> dag.GitModule:
	return (
		dag.git_module(src)
		.set_config()
	)
@func()
example(src: Directory, ): GitModule {
	return dag
		.gitModule(src)
		.setConfig()
}

commitAndPush() 🔗

CommitAndPush permit to commit and push

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gitRepoUrlString -The git repo URL where to commit You need to provide it if you are currently on PullRequest
branchNameString -The branch name where to commit You need to provide it if you are on PullRequest or in Tag
tokenSecret !-The git token
messageString "Commit from CI"The commit message
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@5e49b4f78c709f073f0d2489a4112ae652c3e604 call \
 --src DIR_PATH commit-and-push --token env:MYSECRET
func (m *myModule) example(ctx context.Context, src *Directory, token *Secret) string  {
	return dag.
			GitModule(src).
			CommitAndPush(ctxtoken)
}
@function
async def example(src: dagger.Directory, token: dagger.Secret) -> str:
	return await (
		dag.git_module(src)
		.commit_and_push(token)
	)
@func()
async example(src: Directory, token: Secret): Promise<string> {
	return dag
		.gitModule(src)
		.commitAndPush(token)
}