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@a2f737a5f9950f74d5dd90de4b07880294d45c65

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
func (m *myModule) example(src *Directory) *GitModule  {
	return dag.
			GitModule(src)
}

Types

GitModule 🔗

ci() 🔗

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			Ci(ctx)
}

container() 🔗

Return Type
Container !
Example
func (m *myModule) example(src *Directory) *Container  {
	return dag.
			GitModule(src).
			Container()
}

getCurrentBranchName() 🔗

GetCurrentBranchName Get the current branch name

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			GetCurrentBranchName(ctx)
}

getCurrentUrl() 🔗

GetCurrentUrl get the origin URL

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			GitModule(src).
			GetCurrentUrl(ctx)
}

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
func (m *myModule) 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
func (m *myModule) 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
func (m *myModule) example(ctx context.Context, src *Directory, token *Secret) string  {
	return dag.
			GitModule(src).
			CommitAndPush(ctxtoken)
}