Documentation ¶
Index ¶
- Constants
- Variables
- func AddComponentInputsToRefBuilder(b *app.ReferenceBuilder, r *Resolvers, c *ComponentInputs, g *GenerationInputs) error
- func AddDockerfileToSourceRepositories(b *app.ReferenceBuilder, dockerfile string) error
- func AddImageSourceRepository(sourceRepos app.SourceRepositories, r app.Resolver, g *GenerationInputs) (app.ComponentReference, app.SourceRepositories, error)
- func AddMissingComponentsToRefBuilder(b *app.ReferenceBuilder, repositories app.SourceRepositories, ...) (app.ComponentReferences, error)
- func AddSourceRepositoriesToRefBuilder(b *app.ReferenceBuilder, repos []string, g *GenerationInputs) (app.SourceRepositories, error)
- func DetectSource(repositories []*app.SourceRepository, d app.Detector, g *GenerationInputs) error
- func EnsureHasSource(components app.ComponentReferences, repositories app.SourceRepositories, ...) error
- func InferBuildTypes(components app.ComponentReferences, g *GenerationInputs) (app.ComponentReferences, error)
- type AppConfig
- func (c *AppConfig) AddArguments(args []string) []string
- func (c *AppConfig) DockerRegistrySearcher() app.Searcher
- func (c *AppConfig) GetBuildEnvironment(environment app.Environment) app.Environment
- func (c *AppConfig) HasArguments() bool
- func (c *AppConfig) Querying() bool
- func (c *AppConfig) Run() (*AppResult, error)
- func (c *AppConfig) RunQuery() (*QueryResult, error)
- func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, OriginNamespace string, dockerclient *docker.Client)
- type AppResult
- type ComponentInputs
- type ErrRequiresExplicitAccess
- type GenerationInputs
- type QueryResult
- type ResolvedComponents
- type Resolvers
- type UsageError
Constants ¶
const ( GeneratedByNamespace = "openshift.io/generated-by" GeneratedForJob = "openshift.io/generated-job" GeneratedForJobFor = "openshift.io/generated-job.for" GeneratedByNewApp = "OpenShiftNewApp" GeneratedByNewBuild = "OpenShiftNewBuild" )
Variables ¶
var ErrNoDockerfileDetected = fmt.Errorf("No Dockerfile was found in the repository and the requested build strategy is 'docker'")
ErrNoDockerfileDetected is the error returned when the requested build strategy is Docker and no Dockerfile is detected in the repository.
var ErrNoInputs = fmt.Errorf("no inputs provided")
ErrNoInputs is returned when no inputs are specified
Functions ¶
func AddComponentInputsToRefBuilder ¶ added in v1.1.6
func AddComponentInputsToRefBuilder(b *app.ReferenceBuilder, r *Resolvers, c *ComponentInputs, g *GenerationInputs) error
AddComponentInputsToRefBuilder set up the components to be used by the reference builder.
func AddDockerfileToSourceRepositories ¶ added in v1.1.6
func AddDockerfileToSourceRepositories(b *app.ReferenceBuilder, dockerfile string) error
AddDockerfile adds a Dockerfile passed in the command line to the reference builder.
func AddImageSourceRepository ¶ added in v1.1.6
func AddImageSourceRepository(sourceRepos app.SourceRepositories, r app.Resolver, g *GenerationInputs) (app.ComponentReference, app.SourceRepositories, error)
func AddMissingComponentsToRefBuilder ¶ added in v1.1.6
func AddMissingComponentsToRefBuilder( b *app.ReferenceBuilder, repositories app.SourceRepositories, dockerfileResolver, sourceResolver app.Resolver, g *GenerationInputs, ) (app.ComponentReferences, error)
ComponentsForSourceRepositories creates components for repositories that have not been previously associated by a builder. These components have already gone through source code detection and have a SourceRepositoryInfo attached to them.
func AddSourceRepositoriesToRefBuilder ¶ added in v1.1.6
func AddSourceRepositoriesToRefBuilder(b *app.ReferenceBuilder, repos []string, g *GenerationInputs) (app.SourceRepositories, error)
AddSourceRepositoriesToRefBuilder adds the provided repositories to the reference builder, identifies which should be built using Docker, and then returns the full list of source repositories.
func DetectSource ¶ added in v1.1.6
func DetectSource(repositories []*app.SourceRepository, d app.Detector, g *GenerationInputs) error
DetectSource runs a code detector on the passed in repositories to obtain a SourceRepositoryInfo
func EnsureHasSource ¶ added in v1.1.6
func EnsureHasSource(components app.ComponentReferences, repositories app.SourceRepositories, g *GenerationInputs) error
EnsureHasSource ensure every builder component has source code associated with it. It takes a list of component references that are builders and have not been associated with source, and a set of source repositories that have not been associated with a builder
func InferBuildTypes ¶ added in v1.1.6
func InferBuildTypes(components app.ComponentReferences, g *GenerationInputs) (app.ComponentReferences, error)
InferBuildTypes infers build status and mismatches between source and docker builders
Types ¶
type AppConfig ¶
type AppConfig struct { ComponentInputs GenerationInputs ResolvedComponents *ResolvedComponents SkipGeneration bool AllowSecretUse bool SecretAccessor app.SecretAccessor AsSearch bool AsList bool DryRun bool Out io.Writer ErrOut io.Writer KubeClient kclient.Interface Resolvers Typer runtime.ObjectTyper Mapper meta.RESTMapper ClientMapper resource.ClientMapper OSClient client.Interface OriginNamespace string }
AppConfig contains all the necessary configuration for an application
func NewAppConfig ¶
func NewAppConfig() *AppConfig
NewAppConfig returns a new AppConfig, but you must set your typer, mapper, and clientMapper after the command has been run and flags have been parsed.
func (*AppConfig) AddArguments ¶
AddArguments converts command line arguments into the appropriate bucket based on what they look like
func (*AppConfig) DockerRegistrySearcher ¶ added in v1.1.3
func (*AppConfig) GetBuildEnvironment ¶ added in v1.0.6
func (c *AppConfig) GetBuildEnvironment(environment app.Environment) app.Environment
func (*AppConfig) HasArguments ¶ added in v1.0.5
func (*AppConfig) RunQuery ¶ added in v1.0.5
func (c *AppConfig) RunQuery() (*QueryResult, error)
RunQuery executes the provided config and returns the result of the resolution.
type AppResult ¶
type AppResult struct { List *kapi.List Name string HasSource bool Namespace string GeneratedJobs bool }
AppResult contains the results of an application
type ComponentInputs ¶ added in v1.1.6
type ComponentInputs struct { SourceRepositories []string Components []string ImageStreams []string DockerImages []string Templates []string TemplateFiles []string Groups []string }
ComponentInputs are transformed into ResolvedComponents
type ErrRequiresExplicitAccess ¶ added in v1.0.7
type ErrRequiresExplicitAccess struct { Match app.ComponentMatch Input app.GeneratorInput }
func (ErrRequiresExplicitAccess) Error ¶ added in v1.0.7
func (e ErrRequiresExplicitAccess) Error() string
type GenerationInputs ¶ added in v1.1.6
type GenerationInputs struct { TemplateParameters []string Environment []string Labels map[string]string AddEnvironmentToBuild bool InsecureRegistry bool Strategy string Name string To string NoOutput bool OutputDocker bool Dockerfile string ExpectToBuild bool BinaryBuild bool ContextDir string SourceImage string SourceImagePath string Secrets []string AllowMissingImageStreamTags bool Deploy bool AsTestDeployment bool AllowGenerationErrors bool }
GenerationInputs control how new-app creates output TODO: split these into finer grained structs
type QueryResult ¶ added in v1.0.5
type QueryResult struct { Matches app.ComponentMatches List *kapi.List }
QueryResult contains the results of a query (search or list)
type ResolvedComponents ¶ added in v1.1.6
type ResolvedComponents struct { Components app.ComponentReferences Repositories app.SourceRepositories }
ResolvedComponents is the input to generation
func Resolve ¶ added in v1.1.3
func Resolve(r *Resolvers, c *ComponentInputs, g *GenerationInputs) (*ResolvedComponents, error)
Resolve transforms unstructured inputs (component names, templates, images) into a set of resolved components, or returns an error.
type Resolvers ¶ added in v1.1.6
type Resolvers struct { DockerSearcher app.Searcher ImageStreamSearcher app.Searcher ImageStreamByAnnotationSearcher app.Searcher TemplateSearcher app.Searcher TemplateFileSearcher app.Searcher AllowMissingImages bool Detector app.Detector }
Resolvers are used to identify source repositories, images, or templates in different contexts
func (*Resolvers) DockerfileResolver ¶ added in v1.1.6
func (*Resolvers) ImageSourceResolver ¶ added in v1.1.6
func (*Resolvers) SourceResolver ¶ added in v1.1.6
TODO: why does this differ from ImageSourceResolver?
type UsageError ¶
UsageError is an interface for printing usage errors