Documentation ¶
Index ¶
- Constants
- func GetDockerfile(dockerFile string, okCtx OktetoContextInterface) (string, error)
- func GetRegistryConfigFromOktetoConfig(okCtx OktetoContextInterface) *okteto.ConfigStateless
- func IsDepotEnabled() bool
- func OptsFromBuildInfo(manifestName, svcName string, b *build.Info, o *types.BuildOptions, ...) *types.BuildOptions
- func OptsFromBuildInfoForRemoteDeploy(b *build.Info, o *types.BuildOptions) *types.BuildOptions
- func ResolveAuthConfig(ctx context.Context, dockerCli *command.DockerCli, cli *client.Client, ...) registry.AuthConfig
- type BuildkitLogsFilter
- type ConditionFunc
- type OktetoBuilder
- type OktetoBuilderInterface
- type OktetoCommandErr
- type OktetoContextInterface
- type OktetoRegistryInterface
- type Rule
- type TransformerFunc
Constants ¶
const ( // DeployOutputModeOnBuild Defines the output mode set to BuildOptions when running a remote deploy DeployOutputModeOnBuild = "deploy" // DestroyOutputModeOnBuild Defines the output mode set to BuildOptions when running a remote destroy DestroyOutputModeOnBuild = "destroy" )
const ( DepotTokenEnvVar = "OKTETO_DEPOT_TOKEN" DepotProjectEnvVar = "OKTETO_DEPOT_PROJECT_ID" )
Variables ¶
This section is empty.
Functions ¶
func GetDockerfile ¶
func GetDockerfile(dockerFile string, okCtx OktetoContextInterface) (string, error)
GetDockerfile returns the dockerfile with the cache and registry translations
func GetRegistryConfigFromOktetoConfig ¶
func GetRegistryConfigFromOktetoConfig(okCtx OktetoContextInterface) *okteto.ConfigStateless
func IsDepotEnabled ¶
func IsDepotEnabled() bool
func OptsFromBuildInfo ¶
func OptsFromBuildInfo(manifestName, svcName string, b *build.Info, o *types.BuildOptions, reg regInterface, okCtx OktetoContextInterface) *types.BuildOptions
OptsFromBuildInfo returns the parsed options for the build from the manifest
func OptsFromBuildInfoForRemoteDeploy ¶
func OptsFromBuildInfoForRemoteDeploy(b *build.Info, o *types.BuildOptions) *types.BuildOptions
OptsFromBuildInfoForRemoteDeploy returns the options for the remote deploy
func ResolveAuthConfig ¶
func ResolveAuthConfig(ctx context.Context, dockerCli *command.DockerCli, cli *client.Client, repoInfo *dockerRegistry.RepositoryInfo) registry.AuthConfig
Types ¶
type BuildkitLogsFilter ¶
type BuildkitLogsFilter struct {
// contains filtered or unexported fields
}
func NewBuildKitLogsFilter ¶
func NewBuildKitLogsFilter(rules []Rule) *BuildkitLogsFilter
func (*BuildkitLogsFilter) Run ¶
func (lf *BuildkitLogsFilter) Run(ss *client.SolveStatus, progress string)
type ConditionFunc ¶
var BuildKitMissingCacheCondition ConditionFunc = func(vertex *client.Vertex) bool { importPattern := `importing cache manifest from .*` if !regexp.MustCompile(importPattern).MatchString(vertex.Name) { return false } errorPattern := `.*: not found` return regexp.MustCompile(errorPattern).MatchString(vertex.Error) }
BuildKitMissingCacheCondition checks if the log contains a missing cache error
type OktetoBuilder ¶
type OktetoBuilder struct { OktetoContext OktetoContextInterface Fs afero.Fs }
OktetoBuilder runs the build of an image
func NewOktetoBuilder ¶
func NewOktetoBuilder(context OktetoContextInterface, fs afero.Fs) *OktetoBuilder
NewOktetoBuilder creates a new instance of OktetoBuilder. It takes an OktetoContextInterface and afero.Fs as parameters and returns a pointer to OktetoBuilder.
func (*OktetoBuilder) GetBuilder ¶
func (ob *OktetoBuilder) GetBuilder() string
func (*OktetoBuilder) Run ¶
func (ob *OktetoBuilder) Run(ctx context.Context, buildOptions *types.BuildOptions, ioCtrl *io.Controller) error
Run runs the build sequence
type OktetoBuilderInterface ¶
type OktetoBuilderInterface interface { GetBuilder() string Run(ctx context.Context, buildOptions *types.BuildOptions, ioCtrl *io.Controller) error }
OktetoBuilderInterface runs the build of an image
type OktetoCommandErr ¶
func (OktetoCommandErr) Error ¶
func (e OktetoCommandErr) Error() string
type OktetoContextInterface ¶
type OktetoContextInterface interface { GetCurrentName() string GetCurrentNamespace() string GetGlobalNamespace() string GetCurrentBuilder() string GetCurrentCertStr() string GetCurrentCfg() *clientcmdapi.Config GetCurrentToken() string GetCurrentUser() string GetCurrentRegister() string ExistsContext() bool IsOkteto() bool IsInsecure() bool UseContextByBuilder() GetTokenByContextName(name string) (string, error) }
type OktetoRegistryInterface ¶
OktetoRegistryInterface checks if an image is at the registry
type TransformerFunc ¶
type TransformerFunc func(vertex *client.Vertex, ss *client.SolveStatus, progress string)
var BuildKitMissingCacheTransformer TransformerFunc = func(vertex *client.Vertex, ss *client.SolveStatus, progress string) { errorPattern := `(.*): not found` re := regexp.MustCompile(errorPattern) matches := re.FindStringSubmatch(vertex.Error) minMatches := 2 if len(matches) < minMatches { return } msg := fmt.Sprintf("[skip] cache image not available: %s", matches[1]) vertex.Error = "" if progress == oktetoLog.TTYFormat { vertex.Name = msg } else { vertex.Completed = nil started := vertex.Started completed := started newVertex := &client.Vertex{ Name: msg, Started: started, Completed: completed, } ss.Vertexes = append(ss.Vertexes, newVertex) } oktetoLog.Info(msg) }
BuildKitMissingCacheTransformer transforms the missing cache error log to a more user-friendly message