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@424f04e5893f93e68a0258c6b8a42095f7470a5aEntrypoint
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
dagger -m github.com/disaster37/dagger-library-go/git-module@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.GitModule {
return dag.
GitModule(src)
}@function
def example(src: dagger.Directory, ) -> dagger.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@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH cifunc (m *MyModule) Example(ctx context.Context, src *dagger.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@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH containerfunc (m *MyModule) Example(src *dagger.Directory) *dagger.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@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH get-current-branch-namefunc (m *MyModule) Example(ctx context.Context, src *dagger.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@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH get-current-urlfunc (m *MyModule) Example(ctx context.Context, src *dagger.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
| Name | Type | Default Value | Description |
|---|---|---|---|
| c | Container ! | - | No description provided |
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH with-custom-container --c IMAGE:TAGfunc (m *MyModule) Example(src *dagger.Directory, c *dagger.Container) *dagger.GitModule {
return dag.
GitModule(src).
WithCustomContainer(c)
}@function
def example(src: dagger.Directory, c: dagger.Container) -> dagger.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
| Name | Type | Default Value | Description |
|---|---|---|---|
| username | String | - | The git username |
| String | - | The git email |
Example
dagger -m github.com/disaster37/dagger-library-go/git-module@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH set-configfunc (m *MyModule) Example(src *dagger.Directory) *dagger.GitModule {
return dag.
GitModule(src).
SetConfig()
}@function
def example(src: dagger.Directory, ) -> dagger.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
| 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
dagger -m github.com/disaster37/dagger-library-go/git-module@424f04e5893f93e68a0258c6b8a42095f7470a5a call \
--src DIR_PATH commit-and-push --token env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory, token *dagger.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)
}