Dagger
Search

okteto-dagger-module

Preview environments give you a sharable URL for each pull request made so you and everyone on your team can view the changes deployed before they get merged
Read more here: https://www.okteto.com/preview-environments/

Installation

dagger install github.com/okteto/dagger-module@v0.0.6

Entrypoint

Return Type
OktetoDaggerModule
Example
dagger -m github.com/okteto/dagger-module@974e0f921dee7de8c442d9e04c46707a3062051b call \
func (m *myModule) example() *OktetoDaggerModule  {
	return dag.
			OktetoDaggerModule()
}
@function
def example() -> dag.OktetoDaggerModule:
	return (
		dag.okteto_dagger_module()
	)
@func()
example(): OktetoDaggerModule {
	return dag
		.oktetoDaggerModule()
}

Types

OktetoDaggerModule 🔗

setContext() 🔗

Returns a container that has Okteto CLI with the correct context set

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
contextString !-No description provided
tokenString !-No description provided
Example
dagger -m github.com/okteto/dagger-module@974e0f921dee7de8c442d9e04c46707a3062051b call \
 set-context --context string --token string
func (m *myModule) example(context string, token string) *Container  {
	return dag.
			OktetoDaggerModule().
			SetContext(context, token)
}
@function
def example(context: str, token: str) -> dagger.Container:
	return (
		dag.okteto_dagger_module()
		.set_context(context, token)
	)
@func()
example(context: string, token: string): Container {
	return dag
		.oktetoDaggerModule()
		.setContext(context, token)
}

previewDeploy() 🔗

Deploys a preview environment in the specified Okteto context

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repoString !-Repo to deploy
branchString !-Branch to deploy
prString !-URL of the pull request to attach in the Okteto Dashboard
contextString !-Okteto context to be used for deployment
tokenString !-Token to be used to authenticate with the Okteto context
Example
dagger -m github.com/okteto/dagger-module@974e0f921dee7de8c442d9e04c46707a3062051b call \
 preview-deploy --repo string --branch string --pr string --context string --token string
func (m *myModule) example(ctx context.Context, repo string, branch string, pr string, context string, token string) string  {
	return dag.
			OktetoDaggerModule().
			PreviewDeploy(ctx, repo, branch, pr, context, token)
}
@function
async def example(repo: str, branch: str, pr: str, context: str, token: str) -> str:
	return await (
		dag.okteto_dagger_module()
		.preview_deploy(repo, branch, pr, context, token)
	)
@func()
async example(repo: string, branch: string, pr: string, context: string, token: string): Promise<string> {
	return dag
		.oktetoDaggerModule()
		.previewDeploy(repo, branch, pr, context, token)
}

previewDestroy() 🔗

Destroys a preview environment at the specified Okteto context

Return Type
String !
Arguments
NameTypeDefault ValueDescription
branchString !-Branch to deploy (to be used as the name for the preview env)
contextString !-Okteto context to be used for deployment
tokenString !-Token to be used to authenticate with the Okteto context
Example
dagger -m github.com/okteto/dagger-module@974e0f921dee7de8c442d9e04c46707a3062051b call \
 preview-destroy --branch string --context string --token string
func (m *myModule) example(ctx context.Context, branch string, context string, token string) string  {
	return dag.
			OktetoDaggerModule().
			PreviewDestroy(ctx, branch, context, token)
}
@function
async def example(branch: str, context: str, token: str) -> str:
	return await (
		dag.okteto_dagger_module()
		.preview_destroy(branch, context, token)
	)
@func()
async example(branch: string, context: string, token: string): Promise<string> {
	return dag
		.oktetoDaggerModule()
		.previewDestroy(branch, context, token)
}