gitimporter

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPRBatchSize is the default number of PRs to import in a single batch
	// This is to avoid 413 Payload Too Large errors
	DefaultPRBatchSize = 100
)

Variables

View Source
var (
	ErrAbortMigration = errors.New("aborting the migration. please checkout your command and try again")
	ErrInvalidRepoDir = errors.New("directory doesn't contain repo metadata")
)

Functions

This section is empty.

Types

type Flags

type Flags struct {
	SkipUsers     bool
	FileSizeLimit int64
	NoPR          bool
	NoWebhook     bool
	NoRule        bool
	NoLabel       bool
	NoGit         bool // for incremental migration - skip git operations
	PRBatchSize   int  // batch size for PR imports to avoid 413 errors (default: 100)
}

type Importer

type Importer struct {
	Harness harness.Client

	HarnessSpace    string
	HarnessRepo     string // optional for single repo import
	HarnessToken    string
	Endpoint        string
	ZipFileLocation string

	Gitness bool
	Tracer  tracer.Tracer
	Report  map[string]*report.Report

	RequestId string
	// contains filtered or unexported fields
}

Importer imports data from gitlab to Harness.

func NewImporter

func NewImporter(
	baseURL,
	space,
	repo,
	token,
	location,
	requestId string,
	gitness,
	trace bool,
	flags Flags,
	tracer tracer.Tracer,
	report map[string]*report.Report,
) *Importer

func (*Importer) CheckUsers

func (m *Importer) CheckUsers(users []string) ([]string, error)

func (*Importer) CreateRepo

func (m *Importer) CreateRepo(
	repo *types.Repository,
	targetSpace string,
	tracer tracer.Tracer,
) (*harness.Repository, error)

func (*Importer) Import

func (m *Importer) Import(ctx context.Context) error

func (*Importer) ImportBranchRules

func (m *Importer) ImportBranchRules(
	repoRef string,
	repoFolder string,
) error

func (*Importer) ImportLabels added in v0.24.0

func (m *Importer) ImportLabels(
	repoRef string,
	repoFolder string,
) error

func (*Importer) ImportPullRequests

func (m *Importer) ImportPullRequests(
	repoRef string,
	repoFolder string,
) error

func (*Importer) ImportWebhooks

func (m *Importer) ImportWebhooks(
	repoRef string,
	repoFolder string,
) error

func (*Importer) Push

func (m *Importer) Push(
	ctx context.Context,
	repoRef string,
	repoPath string,
	repo *harness.Repository,
	gitLFSDisabled bool,
	lfsObjectCount int,
	tracer tracer.Tracer,
) error

func (*Importer) ReadRepoInfo

func (m *Importer) ReadRepoInfo(dir string) (types.Repository, error)

type IncrementalMigrationHandler added in v0.44.0

type IncrementalMigrationHandler struct {
	// contains filtered or unexported fields
}

func NewIncrementalMigrationHandler added in v0.44.0

func NewIncrementalMigrationHandler(
	harnessClient harness.Client,
	tracer tracer.Tracer,
	repoRef string,
) *IncrementalMigrationHandler

func (*IncrementalMigrationHandler) CheckRepositoryExists added in v0.44.0

func (h *IncrementalMigrationHandler) CheckRepositoryExists(ctx context.Context) error

func (*IncrementalMigrationHandler) GetPROffset added in v0.44.0

func (h *IncrementalMigrationHandler) GetPROffset(ctx context.Context) (int, error)

func (*IncrementalMigrationHandler) UpdatePRReferences added in v0.44.0

func (h *IncrementalMigrationHandler) UpdatePRReferences(ctx context.Context, gitDir string, offset int) error

Jump to

Keyboard shortcuts

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