Dagger
Search

orchestrator

Todo o comportamento vem de um `ci/pipeline.toml` do projeto consumidor: os
targets declarados lá viram simultaneamente as estratégias de build, os checks
de qualidade e o mapa de imagens usado por CheckImages/Promote. Isso torna
impossível o drift entre "o que se builda" e "o que se promove", e dispensa o
módulo Dagger por projeto que existia até a versão 2.x.

Installation

dagger install github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23

Entrypoint

Return Type
Orchestrator !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Diretório raiz do repositório do projeto.
configPathString !"ci/pipeline.toml"Caminho do arquivo declarativo de pipeline, relativo à raiz do repositório.
Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string
func (m *MyModule) Example(configPath string) *dagger.Orchestrator  {
	return dag.
			Orchestrator(configPath)
}
@function
def example(configpath: str) -> dagger.Orchestrator:
	return (
		dag.orchestrator(configpath)
	)
@func()
example(configPath: string): Orchestrator {
	return dag
		.orchestrator(configPath)
}

Types

Orchestrator 🔗

Orchestrator expõe as funções de pipeline dirigidas pela configuração declarativa do projeto.

source() 🔗

Source é a raiz do repositório do projeto consumidor.

Return Type
Directory !
Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string source
func (m *MyModule) Example(configPath string) *dagger.Directory  {
	return dag.
			Orchestrator(configPath).
			Source()
}
@function
def example(configpath: str) -> dagger.Directory:
	return (
		dag.orchestrator(configpath)
		.source()
	)
@func()
example(configPath: string): Directory {
	return dag
		.orchestrator(configPath)
		.source()
}

configPath() 🔗

ConfigPath é o caminho do arquivo declarativo, relativo à raiz.

Return Type
String !
Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string config-path
func (m *MyModule) Example(ctx context.Context, configPath string) string  {
	return dag.
			Orchestrator(configPath).
			Configpath(ctx)
}
@function
async def example(configpath: str) -> str:
	return await (
		dag.orchestrator(configpath)
		.configpath()
	)
@func()
async example(configPath: string): Promise<string> {
	return dag
		.orchestrator(configPath)
		.configPath()
}

checkImages() 🔗

CheckImages verifica se todas as imagens derivadas da configuração existem no registry antes da promoção.

Targets custom NÃO são ignorados: suas imagens existem no registry e precisam ser verificadas como qualquer outra.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
registryString !-

URL do registry Docker.

registryUserString !-

Usuário para autenticação no registry.

registryPasswordSecret !-

Senha para autenticação no registry.

buildBranchString "origin/develop"

Ref Git da branch onde as imagens foram construídas (ex: “origin/develop”).

Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string check-images --registry string --registry-user string --registry-password env:MYSECRET
func (m *MyModule) Example(ctx context.Context, configPath string, registry string, registryUser string, registryPassword *dagger.Secret)   {
	return dag.
			Orchestrator(configPath).
			Checkimages(ctx, registry, registryUser, registryPassword)
}
@function
async def example(configpath: str, registry: str, registryuser: str, registrypassword: dagger.Secret) -> None:
	return await (
		dag.orchestrator(configpath)
		.checkimages(registry, registryuser, registrypassword)
	)
@func()
async example(configPath: string, registry: string, registryUser: string, registryPassword: Secret): Promise<void> {
	return dag
		.orchestrator(configPath)
		.checkImages(registry, registryUser, registryPassword)
}

checkQuality() 🔗

CheckQuality roda testes e análise estática (Sonar) nos targets alterados que declaram sonar = true.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
baseBranchString !-

Branch base para comparar as mudanças (ex: “origin/develop”).

commitShaString !-

Digest do commit atual (sha completo) para reporting de status.

sonarHostString !-

URL do SonarQube.

sonarTokenSecret !-

Token de autenticação do SonarQube.

stopOnFirstFailBoolean !false

Se true, para no primeiro target que falhar.

gitlabHostString -

URL base do GitLab (ex: CI_SERVER_URL). Se vazio, commit statuses não são reportados.

gitlabTokenSecret -

Token com scope api para autenticação no GitLab.

gitlabProjectIdString -

ID numérico do projeto no GitLab (ex: CI_PROJECT_ID).

Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string check-quality --base-branch string --commit-sha string --sonar-host string --sonar-token env:MYSECRET --stop-on-first-fail boolean
func (m *MyModule) Example(ctx context.Context, configPath string, baseBranch string, commitSha string, sonarHost string, sonarToken *dagger.Secret, stopOnFirstFail bool)   {
	return dag.
			Orchestrator(configPath).
			Checkquality(ctx, baseBranch, commitSha, sonarHost, sonarToken, stopOnFirstFail)
}
@function
async def example(configpath: str, basebranch: str, commitsha: str, sonarhost: str, sonartoken: dagger.Secret, stoponfirstfail: bool) -> None:
	return await (
		dag.orchestrator(configpath)
		.checkquality(basebranch, commitsha, sonarhost, sonartoken, stoponfirstfail)
	)
@func()
async example(configPath: string, baseBranch: string, commitSha: string, sonarHost: string, sonarToken: Secret, stopOnFirstFail: boolean): Promise<void> {
	return dag
		.orchestrator(configPath)
		.checkQuality(baseBranch, commitSha, sonarHost, sonarToken, stopOnFirstFail)
}

promote() 🔗

Promote promove as imagens derivadas da configuração de staging para produção.

Assim como CheckImages, inclui as imagens de targets custom.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
srcRegistryString !-

Registry de origem (staging).

registryUserString !-

Usuário para autenticação nos registries.

registryPasswordSecret !-

Senha para autenticação nos registries.

dstRegistryString -

Registry de destino (produção). Se vazio, usa srcRegistry.

buildBranchString "origin/develop"

Ref Git da branch onde as imagens foram construídas (ex: “origin/develop”).

Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string promote --src-registry string --registry-user string --registry-password env:MYSECRET
func (m *MyModule) Example(ctx context.Context, configPath string, srcRegistry string, registryUser string, registryPassword *dagger.Secret)   {
	return dag.
			Orchestrator(configPath).
			Promote(ctx, srcRegistry, registryUser, registryPassword)
}
@function
async def example(configpath: str, srcregistry: str, registryuser: str, registrypassword: dagger.Secret) -> None:
	return await (
		dag.orchestrator(configpath)
		.promote(srcregistry, registryuser, registrypassword)
	)
@func()
async example(configPath: string, srcRegistry: string, registryUser: string, registryPassword: Secret): Promise<void> {
	return dag
		.orchestrator(configPath)
		.promote(srcRegistry, registryUser, registryPassword)
}

publishAll() 🔗

PublishAll constrói e publica as imagens de todos os targets alterados e, se gitRemoteUrl for informado, commita os arquivos de versão bumpados.

Retorna a lista de imagens publicadas, uma por linha.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
baseBranchString !-

Branch base para comparar as mudanças (ex: “origin/develop”).

commitShaString !-

Digest do commit atual (sha completo).

versionString !-

Versão da aplicação no formato CalVer.

registryString !-

Registry Docker para onde as imagens serão publicadas.

registryUserString !-

Nome de usuário para autenticação no registry.

registryPasswordSecret !-

Senha do usuário para autenticação no registry.

gitlabHostString -

URL base do GitLab (ex: CI_SERVER_URL). Se vazio, commit statuses não são reportados.

gitlabTokenSecret -

Token com scope api para autenticação no GitLab.

gitlabProjectIdString -

ID numérico do projeto no GitLab (ex: CI_PROJECT_ID).

gitRemoteUrlString -

URL do repositório Git com credenciais para push das versões bumpadas. Se vazio, o bump de versão não é commitado.

gitBranchString "develop"

Branch Git para push das versões bumpadas.

Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string publish-all --base-branch string --commit-sha string --version string --registry string --registry-user string --registry-password env:MYSECRET
func (m *MyModule) Example(ctx context.Context, configPath string, baseBranch string, commitSha string, version string, registry string, registryUser string, registryPassword *dagger.Secret) string  {
	return dag.
			Orchestrator(configPath).
			Publishall(ctx, baseBranch, commitSha, version, registry, registryUser, registryPassword)
}
@function
async def example(configpath: str, basebranch: str, commitsha: str, version: str, registry: str, registryuser: str, registrypassword: dagger.Secret) -> str:
	return await (
		dag.orchestrator(configpath)
		.publishall(basebranch, commitsha, version, registry, registryuser, registrypassword)
	)
@func()
async example(configPath: string, baseBranch: string, commitSha: string, version: string, registry: string, registryUser: string, registryPassword: Secret): Promise<string> {
	return dag
		.orchestrator(configPath)
		.publishAll(baseBranch, commitSha, version, registry, registryUser, registryPassword)
}

validate() 🔗

Validate carrega e valida o arquivo declarativo, devolvendo um relatório legível com os targets resolvidos e o mapa de imagens derivado.

Não faz nenhuma chamada de rede: é o job de lint da configuração.

Return Type
String !
Example
dagger -m github.com/BasisTI/daggerverse/orchestrator@cba08bc28860c15623cd86abb27677402fd38b23 call \
 --config-path string validate
func (m *MyModule) Example(ctx context.Context, configPath string) string  {
	return dag.
			Orchestrator(configPath).
			Validate(ctx)
}
@function
async def example(configpath: str) -> str:
	return await (
		dag.orchestrator(configpath)
		.validate()
	)
@func()
async example(configPath: string): Promise<string> {
	return dag
		.orchestrator(configPath)
		.validate()
}