importcmd

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChartsDir = "charts"
)

Variables

This section is empty.

Functions

func NewCmdImport

func NewCmdImport(commonOpts *opts.CommonOptions) *cobra.Command

NewCmdImport the cobra command for jwizard import

func SaveDir added in v0.0.17

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 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 {
	*opts.CommonOptions

	RepoURL                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
	DisableMaven           bool
	UseDefaultGit          bool
	GithubAppInstalled     bool
	GitHub                 bool
	DryRun                 bool
	SelectAll              bool
	DisableBuildPack       bool
	DisableWebhooks        bool
	DisableDotGitSearch    bool
	InitialisedGit         bool
	DeployOptions          v1.DeployOptions
	GitRepositoryOptions   gits.GitRepositoryOptions
	GitDetails             gits.CreateRepoData
	Jenkins                gojenkins.JenkinsClient
	GitServer              *auth.AuthServer
	GitUserAuth            *auth.UserAuth
	GitProvider            gits.GitProvider
	PostDraftPackCallback  CallbackFn
	JXFactory              jxfactory.Factory

	Destination ImportDestination
	// contains filtered or unexported fields
}

ImportOptions options struct for jwizard import

func NewCmdImportAndOptions

func NewCmdImportAndOptions(commonOpts *opts.CommonOptions) (*cobra.Command, *ImportOptions)

NewCmdImportAndOptions creates the cobra command for jwizard 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 (o *ImportOptions) ConfigureImportOptions(repoData *gits.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) DiscoverRemoteGitURL

func (o *ImportOptions) DiscoverRemoteGitURL() error

DiscoverRemoteGitURL finds the git url by looking in the directory and looking for a .git/config file

func (*ImportOptions) EvaluateBuildPack

func (o *ImportOptions) EvaluateBuildPack(jenkinsfile string) error

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

func (*ImportOptions) GenerateProwConfig

func (o *ImportOptions) GenerateProwConfig(currentNamespace string, devEnv *v1.Environment) error

GenerateProwConfig regenerates the Prow configurations after we have created a SourceRepository

func (*ImportOptions) GetGitRepositoryDetails

func (o *ImportOptions) GetGitRepositoryDetails() (*gits.CreateRepoData, error)

GetGitRepositoryDetails determines the git repository details to use during the import command

func (*ImportOptions) GetJXFactory added in v0.0.16

func (o *ImportOptions) GetJXFactory() jxfactory.Factory

GetJXFactory lazily creates a new jx factory

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) GetReporter

func (o *ImportOptions) GetReporter() ImportReporter

GetReporter returns the reporter interface

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) ImportProjectIntoJenkins

func (o *ImportOptions) ImportProjectIntoJenkins(jc gojenkins.JenkinsClient, gitURL, dir, jenkinsfile, branchPattern, credentials string, failIfExists bool, gitProvider gits.GitProvider, authConfigSvc auth.ConfigService, isEnvironment, batchMode bool) error

ImportProjectIntoJenkins imports a MultiBranchProject into Jenkins for the given git URL

func (*ImportOptions) ImportProjectsFromGitHub

func (o *ImportOptions) ImportProjectsFromGitHub() error

ImportProjectsFromGitHub import projects from github

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) JenkinsClient

func (o *ImportOptions) JenkinsClient() (gojenkins.JenkinsClient, error)

func (*ImportOptions) LogImportedProject

func (o *ImportOptions) LogImportedProject(isEnvironment bool, gitInfo *gits.GitRepository)

LogImportedProject logs more details for an imported project

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) 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

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 JenkinsProjectOptions

type JenkinsProjectOptions struct {
	GitInfo       *gits.GitRepository
	GitProvider   gits.GitProvider
	Credentials   string
	BranchPattern string
	Jenkinsfile   string
}

JenkinsProjectOptions store the required options to create a Jenkins project

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

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

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

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