importcmd

package
v0.0.91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAVEN        = "maven"
	MAVEN_JAVA11 = "maven-java11"
	APPSERVER    = "appserver"
	LIBERTY      = "liberty"
	DROPWIZARD   = "dropwizard"
)
View Source
const (
	ChartsDir = "charts"
)

Variables

This section is empty.

Functions

func IsGitOpsRepositoryWithPipeline added in v0.0.54

func IsGitOpsRepositoryWithPipeline(dir string) (bool, error)

IsGitOpsRepositoryWithPipeline returns true if we have detected a GitOps repository for Jenkins X 3.x

func NewCmdImport

func NewCmdImport() *cobra.Command

NewCmdImport the cobra command for jx-project import

func PomFlavour added in v0.0.78

func PomFlavour(path string) (string, error)

func QuestionAnswer added in v0.0.78

func QuestionAnswer(question string, answer string) string

QuestionAnswer returns strings like Cobra question/answers for default cli options

func SaveDir

func SaveDir(c *kchart.Chart, dest string, packName string) error

SaveDir saves a chart as files in a directory.

Types

type CallbackFn

type CallbackFn func() error

CallbackFn callback function

type CreateRepoData added in v0.0.78

type CreateRepoData struct {
	Organisation string
	RepoName     string
	FullName     string
	Private      bool
}

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 {
	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
	DisableMaven                       bool
	UseDefaultGit                      bool
	GithubAppInstalled                 bool
	GitHub                             bool
	DryRun                             bool
	SelectAll                          bool
	DisableBuildPack                   bool
	DisableWebhooks                    bool
	DisableDotGitSearch                bool
	DisableStartPipeline               bool
	InitialisedGit                     bool
	WaitForSourceRepositoryPullRequest bool
	NoDevPullRequest                   bool
	BatchMode                          bool
	IgnoreExistingRepository           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

	PostDraftPackCallback CallbackFn

	Destination ImportDestination
	// 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) AddImportFlags

func (o *ImportOptions) AddImportFlags(cmd *cobra.Command, createProject bool)

func (*ImportOptions) CloneRepository

func (o *ImportOptions) CloneRepository() error

CloneRepository clones a repository

func (*ImportOptions) ConfigureImportOptions

func (options *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) DiscoverBuildPack

func (o *ImportOptions) DiscoverBuildPack(dir string, projectConfig *config.ProjectConfig, packConfig string) (string, error)

DiscoverBuildPack discovers the build pack given the build pack configuration

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(jenkinsfile string) error

EvaluateBuildPack performs an evaluation of the build pack on the current source

func (*ImportOptions) GetGitRepositoryDetails

func (options *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 added in v0.0.78

func (o *ImportOptions) GetOwner(gitUsername string) (string, error)

func (*ImportOptions) GetReporter

func (o *ImportOptions) GetReporter() ImportReporter

GetReporter returns the reporter interface

func (*ImportOptions) Git added in v0.0.78

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 added in v0.0.78

func (o *ImportOptions) IsGitHubAppMode() (bool, error)

func (*ImportOptions) PickBuildPackLibrary

func (o *ImportOptions) PickBuildPackLibrary(i *InvokeDraftPack) (*v1.BuildPack, *v1.TeamSettings, error)

PickBuildPackLibrary lets you pick a build pack

func (*ImportOptions) PickBuildPackName

func (o *ImportOptions) PickBuildPackName(i *InvokeDraftPack, dir string, chosenPack string) (string, error)

PickBuildPackName if not in batch mode lets confirm to the user which build pack we are going to use

func (*ImportOptions) PickImportDestination

func (o *ImportOptions) PickImportDestination(cf *jenkinsutil.ClientFactory, jenkinsfile string) (ImportDestination, error)

PickImportDestination picks where to import the project to

func (*ImportOptions) PickNewOrExistingGitRepository added in v0.0.78

func (o *ImportOptions) PickNewOrExistingGitRepository() (*CreateRepoData, error)

func (*ImportOptions) PickOwner added in v0.0.78

func (o *ImportOptions) PickOwner(userName string) (string, error)

PickOwner picks a git owner

func (*ImportOptions) PickRepoName added in v0.0.78

func (o *ImportOptions) PickRepoName(owner string, 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) Run

func (o *ImportOptions) Run() error

Run executes the command

func (*ImportOptions) SetReporter

func (o *ImportOptions) SetReporter(reporter ImportReporter)

SetReporter overrides the reporter interface

func (*ImportOptions) Validate added in v0.0.78

func (o *ImportOptions) Validate() error

Validate validates the command line options

func (*ImportOptions) ValidateRepositoryName added in v0.0.78

func (o *ImportOptions) ValidateRepositoryName(owner string, 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
	CustomDraftPack             string
	Jenkinsfile                 string
	InitialisedGit              bool
	DisableAddFiles             bool
	UseNextGenPipeline          bool
	CreateJenkinsxYamlIfMissing bool
	ProjectConfig               *config.ProjectConfig
}

InvokeDraftPack used to pass arguments into the draft pack invocation

type JenkinsDestination

type JenkinsDestination struct {
	jenkinsutil.JenkinsSelectorOptions
	Enabled             bool
	JenkinsServiceNames []string
}

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

type JenkinsfileRunnerDestination struct {
	Enabled bool
	Image   string
}

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 string, 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 []*kchart.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

func FromDir(dir string) (*Pack, error)

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.

func (*Pack) SaveDir

func (p *Pack) SaveDir(dest string, packName string) error

SaveDir saves a pack as files in a directory.

Directories

Path Synopsis
test_data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL