plugsupport

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package plugsupport provides implementations for loading migrator plugins.

Users of the `migrator` tool should not import or use this package (just the base "infra/tools/migrator" package).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIFromPlugin

func APIFromPlugin(plug *plugin.Plugin) (constructor migrator.InstantiateAPI, err error)

APIFromPlugin extracts all API symbols from `plug`, returning them as a single interface implementation.

`warnings` contains a list of plugin load warnings; It would be good to elevate these to the user so they could be aware of e.g. a misspelled method name or similar.

This returns an error if a plugin symbol was defined, but has the wrong type.

func CreateOrLoadRepo

func CreateOrLoadRepo(ctx context.Context, project ProjectDir, projID string, projPB *configpb.Project) (ret migrator.Repo, newCheckout bool, err error)

CreateOrLoadRepo loads a new repo, checking it out if it's not available locally.

If `projPB` is nil, the repo MUST exist locally, or this returns an error.

Returns `true` if this did a new checkout.

func DumpReports

func DumpReports(ctx context.Context) *migrator.ReportDump

DumpReports returns all collected Report information within `ctx`.

func HasActionableReports

func HasActionableReports(ctx context.Context) (actionable bool)

HasActionableReports returns `true` if `ctx` contains any Reports where Actionable is true.

func InitReportSink

func InitReportSink(ctx context.Context) context.Context

InitReportSink adds a new empty ReportSink to context and returns the new context.

If there's an existing ReportSink, it will be hidden by this.

func RemoteProject

func RemoteProject(ctx context.Context, projID string) migrator.Project

RemoteProject returns a new migrator.Project object for `projID`.

Types

type ProjectDir

type ProjectDir string

ProjectDir is an absolute path to a migrator project directory.

func FindProjectRoot

func FindProjectRoot(abspath string) (ProjectDir, error)

FindProjectRoot finds a migrator ProjectDir starting from `abspath` and working up towards the filesystem root.

func (ProjectDir) CleanTrash

func (p ProjectDir) CleanTrash() error

CleanTrash removes TrashDir().

func (ProjectDir) ConfigDir

func (p ProjectDir) ConfigDir() string

ConfigDir returns the absolute path of the migrator project's config directory.

func (ProjectDir) ConfigFile

func (p ProjectDir) ConfigFile() string

ConfigFile returns the absolute path of the migrator project's main config file.

The existance of this file is used to determine if a folder is a migrator project.

func (ProjectDir) MkTempDir

func (p ProjectDir) MkTempDir() (string, error)

MkTempDir generates a new temporary directory within TrashDir().

func (ProjectDir) PluginDir

func (p ProjectDir) PluginDir() string

PluginDir returns the absolute path of the migrator project's plugin code directory.

func (ProjectDir) ProjectLog

func (p ProjectDir) ProjectLog(projectID string) string

ProjectLog returns the absolute path of the scan log for a given LUCI project within this migrator project.

func (ProjectDir) ProjectRepo

func (p ProjectDir) ProjectRepo(projectID string) string

ProjectRepo returns the path for a specific LUCI project's git checkout.

func (ProjectDir) ProjectRepoTemp

func (p ProjectDir) ProjectRepoTemp(projectID string) string

ProjectRepoTemp returns a LUCI project temporary checkout directory.

During repo creation, the initial git repo is cloned here and then moved to its ProjectRepo() path on success.

func (ProjectDir) ReportPath

func (p ProjectDir) ReportPath() string

ReportPath returns the absolute path of the migrator project's CSV scan report file.

func (ProjectDir) TrashDir

func (p ProjectDir) TrashDir() string

TrashDir returns the absolute path of the migrator project's trash directory.

The trash directory is used to compile the plugin; New runs of migrator will make best-effort attempts to clean up this directory using CleanTrash().

Directories

Path Synopsis
Package templates is generated by go.chromium.org/luci/tools/cmd/assets.
Package templates is generated by go.chromium.org/luci/tools/cmd/assets.

Jump to

Keyboard shortcuts

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