Documentation
¶
Index ¶
- Constants
- func CheckForUsesImage(dir, triggersFile string) (bool, error)
- func IsRemoteClusterGitRepository(dir string) (bool, error)
- func NewCmdImport() *cobra.Command
- func PomFlavour(packsDir, pomPath string) (string, error)
- func QuestionAnswer(question, answer string) string
- func SaveDir(c *chart.Chart, dest, packName string) error
- type CallbackFn
- type CreateRepoData
- type ImportDestination
- type ImportOptions
- func (o *ImportOptions) AddAndAcceptCollaborator(newRepository bool) error
- func (o *ImportOptions) AddImportFlags(cmd *cobra.Command, createProject bool)
- func (o *ImportOptions) CloneDevEnvironment() (string, error)
- func (o *ImportOptions) CloneRepository() error
- func (o *ImportOptions) ConfigureImportOptions(repoData *CreateRepoData)
- func (o *ImportOptions) CreateNewRemoteRepository() error
- func (o *ImportOptions) CreateProwOwnersAliasesFile() error
- func (o *ImportOptions) CreateProwOwnersFile() error
- func (o *ImportOptions) DefaultGitIgnore() error
- func (o *ImportOptions) DefaultValuesFromTeamSettings(settings *v1.TeamSettings) error
- func (o *ImportOptions) DefaultsFromTeamSettings() error
- func (o *ImportOptions) DiscoverGit() error
- func (o *ImportOptions) EvaluateBuildPack(devEnvCloneDir, jenkinsfile string) error
- func (o *ImportOptions) GetGitRepositoryDetails() (*CreateRepoData, error)
- func (o *ImportOptions) GetOrganisation() string
- func (o *ImportOptions) GetOwner(gitUsername string) (string, error)
- func (o *ImportOptions) GetReporter() ImportReporter
- func (o *ImportOptions) Git() gitclient.Interface
- func (o *ImportOptions) HasJenkinsfile() (string, error)
- func (o *ImportOptions) InitBuildPacks(i *InvokeDraftPack) (string, *v1.TeamSettings, error)
- func (o *ImportOptions) InvokeDraftPack(i *InvokeDraftPack) (string, error)
- func (o *ImportOptions) IsGitHubAppMode() (bool, error)
- func (o *ImportOptions) PickCatalogFolderName(dir, chosenPack string) (string, error)
- func (o *ImportOptions) PickImportDestination(devEnvCloneDir string) (ImportDestination, error)
- func (o *ImportOptions) PickNewOrExistingGitRepository() (*CreateRepoData, error)
- func (o *ImportOptions) PickOwner(userName string) (string, error)
- func (o *ImportOptions) PickPipelineCatalog(i *InvokeDraftPack) (*v1alpha1.PipelineCatalogSource, *v1.TeamSettings, error)
- func (o *ImportOptions) PickRepoName(owner, defaultName string, allowExistingRepo bool) (string, error)
- func (o *ImportOptions) ReplacePlaceholders(gitServerName, dockerRegistryOrg string) error
- func (o *ImportOptions) Run() error
- func (o *ImportOptions) SetReporter(reporter ImportReporter)
- func (o *ImportOptions) Validate() error
- func (o *ImportOptions) ValidateRepositoryName(owner, name string) error
- type ImportReporter
- type InvokeDraftPack
- type JenkinsDestination
- type JenkinsXDestination
- type JenkinsfileRunnerDestination
- type LogImportReporter
- func (r *LogImportReporter) CreatedDevRepoPullRequest(prURL, devGitURL string)
- func (r *LogImportReporter) CreatedProject(genDir string)
- func (r *LogImportReporter) GeneratedQuickStartAt(genDir string)
- func (r *LogImportReporter) GitRepositoryCreated()
- func (r *LogImportReporter) PushedGitRepository(repoURL string)
- func (r *LogImportReporter) Trace(message string, args ...interface{})
- func (r *LogImportReporter) UsingGitUserName(username string)
- type Pack
Constants ¶
const ( MAVEN = "maven" APPSERVER = "appserver" LIBERTY = "liberty" DROPWIZARD = "dropwizard" )
const (
ChartsDir = "charts"
)
const (
JenkinsfileName = "Jenkinsfile"
)
Variables ¶
This section is empty.
Functions ¶
func CheckForUsesImage ¶
CheckForUsesImage checks if the given dir and trigger file has a uses: image which if present assumes we are using uses: inheritance rather than kpt
func IsRemoteClusterGitRepository ¶ added in v0.0.203
IsRemoteClusterGitRepository returns true if we have detected a GitOps repository for Jenkins X 3.x
func NewCmdImport ¶
NewCmdImport the cobra command for jx-project import
func PomFlavour ¶
func QuestionAnswer ¶
QuestionAnswer returns strings like Cobra question/answers for default cli options
Types ¶
type CreateRepoData ¶
type ImportDestination ¶
type ImportDestination struct {
JenkinsX JenkinsXDestination
Jenkins JenkinsDestination
JenkinsfileRunner JenkinsfileRunnerDestination
}
Destination where do we want to import the project to
type ImportOptions ¶
type ImportOptions struct {
options.BaseOptions
Args []string
RepoURL string
GitProviderURL string
DiscoveredGitURL string
Dir string
Organisation string
Repository string
// Credentials string
AppName string
SelectFilter string
Jenkinsfile string
// BranchPattern string
ImportGitCommitMessage string
Pack string
DockerRegistryOrg string
DeployKind string
SchedulerName string
GitConfDir string
PipelineUserName string
PipelineServer string
// ImportMode string
ServiceAccount string
Namespace string
OperatorNamespace string
BootSecretName string
PipelineCatalogDir string
DisableMaven bool
GithubAppInstalled bool
GitHub bool
DryRun bool
SelectAll bool
DisableBuildPack bool
DisableWebhooks bool
DisableDotGitSearch bool
DisableStartPipeline bool
InitialisedGit bool
WaitForSourceRepositoryPullRequest bool
NoDevPullRequest bool
IgnoreExistingRepository bool
IgnoreCollaborator bool
PullRequestPollPeriod time.Duration
PullRequestPollTimeout time.Duration
DeployOptions v1.DeployOptions
GitRepositoryOptions scm.RepositoryInput
KubeClient kubernetes.Interface
JXClient versioned.Interface
Input input.Interface
ScmFactory scmhelpers.Factory
Gitter gitclient.Interface
CommandRunner cmdrunner.CommandRunner
DevEnv *v1.Environment
BootScmClient *scm.Client
OnCompleteCallback func() error
PostDraftPackCallback CallbackFn
Destination ImportDestination
PackFilter func(*Pack)
// env customization
EnvName string
EnvStrategy string
NestedRepo bool
// contains filtered or unexported fields
}
ImportOptions options struct for jx-project import
func NewCmdImportAndOptions ¶
func NewCmdImportAndOptions() (*cobra.Command, *ImportOptions)
NewCmdImportAndOptions creates the cobra command for jx-project import and the options
func (*ImportOptions) AddAndAcceptCollaborator ¶
func (o *ImportOptions) AddAndAcceptCollaborator(newRepository bool) error
func (*ImportOptions) AddImportFlags ¶
func (o *ImportOptions) AddImportFlags(cmd *cobra.Command, createProject bool)
func (*ImportOptions) CloneDevEnvironment ¶
func (o *ImportOptions) CloneDevEnvironment() (string, error)
CloneDevEnvironment clones the development environment to a directory
func (*ImportOptions) CloneRepository ¶
func (o *ImportOptions) CloneRepository() error
CloneRepository clones a repository
func (*ImportOptions) ConfigureImportOptions ¶
func (o *ImportOptions) ConfigureImportOptions(repoData *CreateRepoData)
ConfigureImportOptions updates the import options struct based on values from the create repo struct
func (*ImportOptions) CreateNewRemoteRepository ¶
func (o *ImportOptions) CreateNewRemoteRepository() error
CreateNewRemoteRepository creates a new remote repository
func (*ImportOptions) CreateProwOwnersAliasesFile ¶
func (o *ImportOptions) CreateProwOwnersAliasesFile() error
CreateProwOwnersAliasesFile creates an OWNERS_ALIASES file in the root of the project assigning the current Git user as an approver and a reviewer.
func (*ImportOptions) CreateProwOwnersFile ¶
func (o *ImportOptions) CreateProwOwnersFile() error
CreateProwOwnersFile creates an OWNERS file in the root of the project assigning the current Git user as an approver and a reviewer. If the file already exists, does nothing.
func (*ImportOptions) DefaultGitIgnore ¶
func (o *ImportOptions) DefaultGitIgnore() error
DefaultGitIgnore creates a default .gitignore
func (*ImportOptions) DefaultValuesFromTeamSettings ¶
func (o *ImportOptions) DefaultValuesFromTeamSettings(settings *v1.TeamSettings) error
DefaultValuesFromTeamSettings defaults the repository options from the given team settings
func (*ImportOptions) DefaultsFromTeamSettings ¶
func (o *ImportOptions) DefaultsFromTeamSettings() error
func (*ImportOptions) DiscoverGit ¶
func (o *ImportOptions) DiscoverGit() error
DiscoverGit checks if there is a git clone or prompts the user to import it
func (*ImportOptions) EvaluateBuildPack ¶
func (o *ImportOptions) EvaluateBuildPack(devEnvCloneDir, jenkinsfile string) error
EvaluateBuildPack performs an evaluation of the build pack on the current source
func (*ImportOptions) GetGitRepositoryDetails ¶
func (o *ImportOptions) GetGitRepositoryDetails() (*CreateRepoData, error)
GetGitRepositoryDetails determines the git repository details to use during the import command
func (*ImportOptions) GetOrganisation ¶
func (o *ImportOptions) GetOrganisation() string
GetOrganisation gets the organisation from the RepoURL (if in the github format of github.com/org/repo). It will do this in preference to the Organisation field (if set). If the repo URL does not implicitly specify an organisation then the Organisation specified in the options is used.
func (*ImportOptions) GetOwner ¶
func (o *ImportOptions) GetOwner(gitUsername string) (string, error)
func (*ImportOptions) GetReporter ¶
func (o *ImportOptions) GetReporter() ImportReporter
GetReporter returns the reporter interface
func (*ImportOptions) Git ¶
func (o *ImportOptions) Git() gitclient.Interface
Git returns the gitter - lazily creating one if required
func (*ImportOptions) HasJenkinsfile ¶
func (o *ImportOptions) HasJenkinsfile() (string, error)
HasJenkinsfile returns the ile name if there is a Jenkinsfile or empty string if there is not
func (*ImportOptions) InitBuildPacks ¶
func (o *ImportOptions) InitBuildPacks(i *InvokeDraftPack) (string, *v1.TeamSettings, error)
InitBuildPacks initialise the build packs
func (*ImportOptions) InvokeDraftPack ¶
func (o *ImportOptions) InvokeDraftPack(i *InvokeDraftPack) (string, error)
InvokeDraftPack invokes a draft pack copying in a Jenkinsfile if required
func (*ImportOptions) IsGitHubAppMode ¶
func (o *ImportOptions) IsGitHubAppMode() (bool, error)
func (*ImportOptions) PickCatalogFolderName ¶
func (o *ImportOptions) PickCatalogFolderName(dir, chosenPack string) (string, error)
PickCatalogFolderName if not in batch mode lets confirm to the user which catalog folder we are going to use
func (*ImportOptions) PickImportDestination ¶
func (o *ImportOptions) PickImportDestination(devEnvCloneDir string) (ImportDestination, error)
PickImportDestination picks where to import the project to
func (*ImportOptions) PickNewOrExistingGitRepository ¶
func (o *ImportOptions) PickNewOrExistingGitRepository() (*CreateRepoData, error)
func (*ImportOptions) PickOwner ¶
func (o *ImportOptions) PickOwner(userName string) (string, error)
PickOwner picks a git owner
func (*ImportOptions) PickPipelineCatalog ¶
func (o *ImportOptions) PickPipelineCatalog(i *InvokeDraftPack) (*v1alpha1.PipelineCatalogSource, *v1.TeamSettings, error)
PickPipelineCatalog lets you pick a build pack
func (*ImportOptions) PickRepoName ¶
func (o *ImportOptions) PickRepoName(owner, defaultName string, allowExistingRepo bool) (string, error)
PickRepoName picks the repository name
func (*ImportOptions) ReplacePlaceholders ¶
func (o *ImportOptions) ReplacePlaceholders(gitServerName, dockerRegistryOrg string) error
ReplacePlaceholders replaces app name, git server name, git org, and docker registry org placeholders
func (*ImportOptions) SetReporter ¶
func (o *ImportOptions) SetReporter(reporter ImportReporter)
SetReporter overrides the reporter interface
func (*ImportOptions) Validate ¶
func (o *ImportOptions) Validate() error
Validate validates the command line options
func (*ImportOptions) ValidateRepositoryName ¶
func (o *ImportOptions) ValidateRepositoryName(owner, name string) error
ValidateRepositoryName validates the repository does not exist
type ImportReporter ¶
type ImportReporter interface {
// UsingGitUserName report progress
UsingGitUserName(username string)
// PushedGitRepository report progress
PushedGitRepository(url string)
// GitRepositoryCreated report progress
GitRepositoryCreated()
// CreatedDevRepoPullRequest report progress
CreatedDevRepoPullRequest(prURL string, devGitURL string)
// CreatedProject report progress
CreatedProject(genDir string)
// GeneratedQuickStartAt report progress
GeneratedQuickStartAt(genDir string)
// Trace report generic trace message
Trace(message string, options ...interface{})
}
ImportReporter an interface for reporting updates from the process
type InvokeDraftPack ¶
type InvokeDraftPack struct {
Dir string
DevEnvCloneDir string
CustomDraftPack string
Jenkinsfile string
InitialisedGit bool
DisableAddFiles bool
}
InvokeDraftPack used to pass arguments into the draft pack invocation
type JenkinsDestination ¶
JenkinsDestination configures how to import to a Jenkins server
type JenkinsXDestination ¶
type JenkinsXDestination struct {
Enabled bool
}
JenkinsXDestination configures how to import to Jenkins X
type JenkinsfileRunnerDestination ¶
JenkinsfileRunnerDestination configures how to import to JenkinfilesRunner
type LogImportReporter ¶
type LogImportReporter struct {
}
LogImportReporter default implementation to log to the console
func (*LogImportReporter) CreatedDevRepoPullRequest ¶
func (r *LogImportReporter) CreatedDevRepoPullRequest(prURL, devGitURL string)
CreatedDevRepoPullRequest report progress
func (*LogImportReporter) CreatedProject ¶
func (r *LogImportReporter) CreatedProject(genDir string)
CreatedProject report progress
func (*LogImportReporter) GeneratedQuickStartAt ¶
func (r *LogImportReporter) GeneratedQuickStartAt(genDir string)
GeneratedQuickStartAt report progress
func (*LogImportReporter) GitRepositoryCreated ¶
func (r *LogImportReporter) GitRepositoryCreated()
GitRepositoryCreated report progress
func (*LogImportReporter) PushedGitRepository ¶
func (r *LogImportReporter) PushedGitRepository(repoURL string)
PushedGitRepository report progress
func (*LogImportReporter) Trace ¶
func (r *LogImportReporter) Trace(message string, args ...interface{})
Trace report generic trace message
func (*LogImportReporter) UsingGitUserName ¶
func (r *LogImportReporter) UsingGitUserName(username string)
UsingGitUserName report progress
type Pack ¶
type Pack struct {
// Chart is the Helm chart to be installed with the Pack.
Charts []*chart.Chart
// Files are the files inside the Pack that will be installed.
Files map[string]io.ReadCloser
}
Pack defines a Draft Starter Pack.
func FromDir ¶
CREDIT https://github.com/Azure/draft/blob/9705e36dc23c27c9ef54dc2469dd86ac6093f0f4/pkg/draft/pack/pack.go FromDir takes a string name, tries to resolve it to a file or directory, and then loads it.
This is the preferred way to load a pack. It will discover the pack encoding and hand off to the appropriate pack reader.