git-module
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/disaster37/dagger-library-go/git-module@a2f737a5f9950f74d5dd90de4b07880294d45c65
Entrypoint
Return Type
GitModule !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
src | Directory ! | - | The source |
baseContainer | Container | - | base container |
ci | String | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
c | Container ! | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
username | String | - | The git username |
String | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
gitRepoUrl | String | - | The git repo URL where to commit You need to provide it if you are currently on PullRequest |
branchName | String | - | The branch name where to commit You need to provide it if you are on PullRequest or in Tag |
token | Secret ! | - | The git token |
message | String | "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)
}