Documentation
¶
Index ¶
Constants ¶
const ( DateFormat = "Mon, 2 Jan 2006" DefaultGithubDomain = "github.com" DefaultGitlabDomain = "gitlab.com" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Behavior flags
Loop bool `json:"loop,omitempty"`
Report bool `json:"report,omitempty"`
DetailedReport bool `json:"detailed_report,omitempty"`
DeleteExistingRepos bool `json:"delete_existing_repos,omitempty"`
EnablePullRequests bool `json:"migrate_pull_requests,omitempty"`
NoForce bool `json:"no_force,omitempty"`
PullRequestsOnly bool `json:"pull_requests_only,omitempty"`
RenameMasterToMain bool `json:"rename_master_to_main,omitempty"`
SkipInvalidMergeRequests bool `json:"skip_invalid_merge_requests,omitempty"`
SkipOpenMergeRequests bool `json:"skip_open_merge_requests,omitempty"`
TrimGithubBranches bool `json:"trim_branches_on_github,omitempty"`
UnarchiveArchivedRepos bool `json:"unarchive_archived_repos,omitempty"`
// Repository visibility for newly created GitHub repos
RepoVisibility string `json:"repo_visibility,omitempty"`
// Domain / connection settings
GithubDomain string `json:"github_domain,omitempty"`
GitlabDomain string `json:"gitlab_domain,omitempty"`
// GithubToken and GitlabToken must be supplied via the GITHUB_TOKEN and
// GITLAB_TOKEN environment variables respectively. They are intentionally
// excluded from JSON config file support to avoid plaintext credentials in
// configuration files that may be committed to version control.
GithubToken string `json:"-"`
GitlabToken string `json:"-"`
// Project targets
GithubRepo string `json:"github_repo,omitempty"`
GithubUser string `json:"github_user,omitempty"`
GitlabProject string `json:"gitlab_project,omitempty"`
ProjectsCsvPath string `json:"projects_csv,omitempty"`
// Branch rename options
RenameTrunkBranch string `json:"rename_trunk_branch,omitempty"`
// Logging
LogOutput string `json:"log_output,omitempty"`
LogDirectory string `json:"log_directory,omitempty"`
// Storage
StorageType string `json:"storage_type,omitempty"`
StorageDir string `json:"storage_dir,omitempty"`
// State persistence for resumption
StateDir string `json:"state_dir,omitempty"`
// Concurrency / batching
MaxConcurrency int `json:"max_concurrency,omitempty"`
PushBatchSize int `json:"push_batch_size,omitempty"`
// MR age filter (days)
MergeRequestsAge int `json:"merge_requests_max_age,omitempty"`
// Prepare mode
PrepareMode bool `json:"prepare,omitempty"`
PrepareCloneURL string `json:"prepare_clone_url,omitempty"`
PrepareTargetURL string `json:"prepare_target_url,omitempty"`
PrepareLargeFiles string `json:"prepare_large_files,omitempty"`
PrepareBatchCount int `json:"prepare_batch_count,omitempty"`
// Build-time version (not configurable from file or flags)
Version string `json:"-"`
}
Config holds all runtime configuration for the migrator.
func (*Config) LoadFile ¶
LoadFile reads configuration from a JSON file, merging values into c. Fields present in the file override the current values in c. Fields absent from the file are left unchanged.
Token fields (github_token, gitlab_token) are rejected if found in the config file. Tokens must be supplied via environment variables only.
func (*Config) Validate ¶
Validate checks that the migration configuration is consistent and complete. It returns the first validation error encountered.
func (*Config) ValidatePrepare ¶
ValidatePrepare checks that prepare-mode configuration is consistent.
func (*Config) Warnings ¶ added in v0.18.14
Warnings returns one message for each flag that is set but has no effect because pull requests are not migrated. They are not errors: the run can go on, but the user should know that the flag does nothing. -pull-requests-only implies -migrate-pull-requests. With -report, -skip-open-merge-requests and -merge-requests-max-age change the count, so they get no warning then. The report reads neither -skip-invalid-merge-requests nor -state-dir, also with -migrate-pull-requests, so with -report their warning names -report.