cli

package
v0.0.0-...-a204096 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 32 Imported by: 0

README

How to set up and use the new patch tool

###Client

Basic Usage

  • To submit a patch, run this from your local copy of the mongodb/mongo repo:

    `evergreen patch -p <project-id>`
    

NOTE: The first time you run this, you'll be asked if you want to set these as your default project and variants. After setting defaults, you can omit the flags and the default values will be used, so that just running evergreen patch will work.

Defaults may be changed at any time by editing your ~/.evergreen.yml file.

Extra args to the git diff command used to generate your patch may be specified by appending them after --. For example, to generate a patch relative to the previous commit:

  evergreen patch -- HEAD~1

Or to patch relative to a specific tag:

  evergreen patch -- r3.0.2

For patches containing binary data, you can use the extra args to git diff to include the binary changes by passing through --binary to the git command itself:

  evergreen patch -- --binary

Operating on existing patches

  • To list patches you've created:

    `evergreen list-patches`
    
  • To cancel a patch:

    `evergreen cancel-patch -i <patch_id>`
    
  • To finalize a patch:

    `evergreen finalize-patch -i <patch_id>`
    
  • To add changes to a module on top of an existing patch:

     cd ~/projects/module-project-directory
     evergreen set-module -i <patch_id> -m <module-name>
     ```
    
    
Server Side (for evergreen admins)

To enable auto-updating of client binaries, add a section like this to the settings file for your server:

api:
    clients:
        latest_revision: "c0110ba937047f99c9a68470f6ec51fc6d98c5cc"
        client_binaries:
           - os: "darwin"
             arch: "amd64"
             url: "https://.../evergreen"
           - os: "linux"
             arch: "amd64"
             url: "https://.../evergreen"
           - os: "windows"
             arch: "amd64"
             url: "https://.../evergreen"

The "url" keys in each list item should contain the appropriate URL to the binary for each architecture. The "latest_revision" key should contain the githash that was used to build the binary. It should match the output of "evergreen version" for all the binaries at the URLs listed in order for auto-updates to be successful.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GranularityDays    = "day"
	GranularityMinutes = "minute"
	GranularitySeconds = "second"
	GranularityHours   = "hour"

	HostUtilizationStat     = "host"
	AverageScheduledToStart = "avg"
	OptimalMakespanStat     = "makespan"
)

Functions

func LoadSettings

func LoadSettings(opts *Options) (*model.CLISettings, error)

LoadSettings attempts to load the settings file

func WriteSettings

func WriteSettings(s *model.CLISettings, opts *Options) error

Types

type APIClient

type APIClient struct {
	APIRoot string

	User   string
	APIKey string
	// contains filtered or unexported fields
}

APIClient manages requests to the API server endpoints, and unmarshaling the results into usable structures.

func (*APIClient) CancelPatch

func (ac *APIClient) CancelPatch(patchId string) error

func (*APIClient) CheckUpdates

func (ac *APIClient) CheckUpdates() (*evergreen.ClientConfig, error)

CheckUpdates fetches information about available updates to client binaries from the server.

func (*APIClient) DeletePatchModule

func (ac *APIClient) DeletePatchModule(patchId, module string) error

DeletePatchModule makes a request to the API server to delete the given module from a patch

func (*APIClient) FinalizePatch

func (ac *APIClient) FinalizePatch(patchId string) error

func (*APIClient) GetAverageSchedulerStats

func (ac *APIClient) GetAverageSchedulerStats(granularity, daysBack int, distroId string, csv bool) (io.ReadCloser, error)

GetAverageSchedulerStats takes in an integer granularity, which is in seconds, the number of days back, and a distro id and makes a REST API call to get host utilization statistics.

func (*APIClient) GetConfig

func (ac *APIClient) GetConfig(versionId string) (*model.Project, error)

GetVersionConfig fetches the config requests project details from the API server for a given project ID.

func (*APIClient) GetHostUtilizationStats

func (ac *APIClient) GetHostUtilizationStats(granularity, daysBack int, csv bool) (io.ReadCloser, error)

GetHostUtilizationStats takes in an integer granularity, which is in seconds, and the number of days back and makes a REST API call to get host utilization statistics.

func (*APIClient) GetLastGreen

func (ac *APIClient) GetLastGreen(project string, variants []string) (*version.Version, error)

GetLastGreen returns the most recent successful version for the given project and variants.

func (*APIClient) GetOptimalMakespans

func (ac *APIClient) GetOptimalMakespans(numberBuilds int, csv bool) (io.ReadCloser, error)

GetOptimalMakespan takes in an integer granularity, which is in seconds, and the number of days back and makes a REST API call to get the optimal and actual makespan for builds going back however many days.

func (*APIClient) GetPatch

func (ac *APIClient) GetPatch(patchId string) (*service.RestPatch, error)

GetPatch fetches the config requests project details from the API server for a given project ID.

func (*APIClient) GetPatches

func (ac *APIClient) GetPatches(n int) ([]patch.Patch, error)

GetPatches requests a list of the user's patches from the API and returns them as a list

func (*APIClient) GetProjectRef

func (ac *APIClient) GetProjectRef(projectId string) (*model.ProjectRef, error)

GetProjectRef requests project details from the API server for a given project ID.

func (*APIClient) GetTask

func (ac *APIClient) GetTask(taskId string) (*service.RestTask, error)

func (*APIClient) ListProjects

func (ac *APIClient) ListProjects() ([]model.ProjectRef, error)

func (*APIClient) ListTasks

func (ac *APIClient) ListTasks(project string) ([]model.ProjectTask, error)

func (*APIClient) ListVariants

func (ac *APIClient) ListVariants(project string) ([]model.BuildVariant, error)

func (*APIClient) PutPatch

func (ac *APIClient) PutPatch(incomingPatch patchSubmission) (*patch.Patch, error)

PutPatch submits a new patch for the given project to the API server. If successful, returns the patch object itself.

func (*APIClient) UpdatePatchModule

func (ac *APIClient) UpdatePatchModule(patchId, module, patch, base string) error

UpdatePatchModule makes a request to the API server to set a module patch on the given patch ID.

func (*APIClient) ValidateLocalConfig

func (ac *APIClient) ValidateLocalConfig(data []byte) ([]validator.ValidationError, error)

ValidateLocalConfig validates the local project config with the server

type APIError

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

APIError is an implementation of error for reporting unexpected results from API calls.

func NewAPIError

func NewAPIError(resp *http.Response) APIError

NewAPIError creates an APIError by reading the body of the response and its status code.

func (APIError) Error

func (ae APIError) Error() string

type CancelPatchCommand

type CancelPatchCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	PatchId    string   `short:"i" description:"id of the patch to modify" required:"true"`
}

CancelPatchCommand is used to cancel a patch.

func (*CancelPatchCommand) Execute

func (cpc *CancelPatchCommand) Execute(args []string) error

type EvaluateCommand

type EvaluateCommand struct {
	Tasks    bool `short:"t" long:"tasks" description:"only show task and function definitions"`
	Variants bool `short:"v" long:"variants" description:"only show variant definitions"`
}

EvaluateCommand reads in a project config, expanding tags and matrix definitions, then prints the expanded definitions back out as yaml.

func (*EvaluateCommand) Execute

func (ec *EvaluateCommand) Execute(args []string) error

type ExportCommand

type ExportCommand struct {
	GlobalOpts *Options `no-flag:"true"`

	JSON        bool   `long:"json" description:"set the format to export to json"`
	Granularity string `long:"granularity" description:"set the granularity, default hour, options are 'second', 'minute', 'hour'"`
	Days        int    `long:"days" description:"set the number of days, default 1, max of 30 days back"`
	StatsType   string `` /* 186-byte string literal not displayed */

	DistroId string `long:"distro" description:"distro id - required for average scheduled to start times"`
	Number   int    `long:"number" description:"set the number of revisions (for getting build makespan), default 100"`
	Filepath string `long:"filepath" description:"path to directory where csv file is to be saved"`
}

ExportCommand is used to export statistics

func (*ExportCommand) Execute

func (ec *ExportCommand) Execute(args []string) error

type FetchCommand

type FetchCommand struct {
	GlobalOpts *Options `no-flag:"true"`

	Source    bool   `long:"source" description:"clones the source for the given task"`
	Artifacts bool   `long:"artifacts" description:"fetch artifacts for the task and all its recursive dependents"`
	Shallow   bool   `long:"shallow" description:"don't recursively download artifacts from dependency tasks"`
	NoPatch   bool   `long:"no-patch" description:"when using --source with a patch task, skip applying the patch"`
	Dir       string `long:"dir" description:"root directory to fetch artifacts into. defaults to current working directory"`
	TaskId    string `short:"t" long:"task" description:"task associated with the data to fetch" required:"true"`
}

FetchCommand is used to fetch the source or artifacts associated with a task.

func (*FetchCommand) Execute

func (fc *FetchCommand) Execute(args []string) error

FetchCommand allows the user to download the artifacts for a task (and optionally its dependencies), clone the source that a task was derived from, or both.

type FinalizePatchCommand

type FinalizePatchCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	PatchId    string   `short:"i" description:"id of the patch to modify" required:"true"`
}

FinalizePatchCommand is used to finalize a patch, allowing it to be scheduled.

func (*FinalizePatchCommand) Execute

func (fpc *FinalizePatchCommand) Execute(args []string) error

type GetUpdateCommand

type GetUpdateCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	Install    bool     `long:"install" description:"after downloading update, overwrite old binary with new one"`
}

GetUpdateCommand attempts to fetch the latest version of the client binary and install it over the current one.

func (*GetUpdateCommand) Execute

func (uc *GetUpdateCommand) Execute(args []string) error

type LastGreenCommand

type LastGreenCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	Project    string   `short:"p" long:"project" description:"project to search" required:"true"`
	Variants   []string `short:"v" long:"variants" description:"variant that must be passing" required:"true"`
}

LastGreenCommand contains parameters for the finding a project's most recent passing version.

func (*LastGreenCommand) Execute

func (lgc *LastGreenCommand) Execute(args []string) error

type ListCommand

type ListCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	Project    string   `short:"p" long:"project" description:"project whose variants or tasks should be listed (use with --variants/--tasks)"`
	File       string   `` /* 126-byte string literal not displayed */
	Projects   bool     `long:"projects" description:"list all available projects"`
	Variants   bool     `long:"variants" description:"list all variants for a project"`
	Tasks      bool     `long:"tasks" description:"list all tasks for a project"`
}

func (*ListCommand) Execute

func (lc *ListCommand) Execute(args []string) error

type ListPatchesCommand

type ListPatchesCommand struct {
	GlobalOpts  *Options `no-flag:"true"`
	Variants    []string `short:"v" long:"variants" description:"variants to run the patch on. may be specified multiple times, or use the value 'all'"`
	PatchId     string   `short:"i" description:"show details for only the patch with this ID"`
	ShowSummary bool     `short:"s" long:"show-summary" description:"show a summary of the diff for each patch"`
	Number      *int     `short:"n" long:"number" description:"number of patches to show (0 for all patches)"`
}

ListPatchesCommand is used to list a user's existing patches.

func (*ListPatchesCommand) Execute

func (lpc *ListPatchesCommand) Execute(args []string) error

type Options

type Options struct {
	ConfFile string `short:"c" long:"config" description:"path to config file (defaults to ~/.evergreen.yml)"`
}

type PatchCommand

type PatchCommand struct {
	PatchCommandParams
}

PatchCommand is used to submit a new patch to the API server.

func (*PatchCommand) Execute

func (pc *PatchCommand) Execute(args []string) error

type PatchCommandParams

type PatchCommandParams struct {
	GlobalOpts  *Options `no-flag:"true"`
	Project     string   `short:"p" long:"project" description:"project to submit patch for"`
	Variants    []string `short:"v" long:"variants"`
	Tasks       []string `short:"t" long:"tasks"`
	SkipConfirm bool     `short:"y" long:"yes" description:"skip confirmation text"`
	Description string   `short:"d" long:"description" description:"description of patch (optional)"`
	Finalize    bool     `short:"f" long:"finalize" description:"schedule tasks immediately"`
	Large       bool     `long:"large" description:"enable submitting larger patches (>16MB)"`
}

PatchCommandParams contains parameters common to PatchCommand and PatchFileCommand

type PatchFileCommand

type PatchFileCommand struct {
	PatchCommandParams
	DiffFile string `long:"diff-file" description:"file containing the diff for the patch"`
	Base     string `short:"b" long:"base" description:"githash of base"`
}

PatchFileCommand is used to submit a new patch to the API server using a diff file.

func (*PatchFileCommand) Execute

func (pfc *PatchFileCommand) Execute(args []string) error

type RemoveModuleCommand

type RemoveModuleCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	Module     string   `short:"m" long:"module" description:"name of the module to remove from patch" required:"true" `
	PatchId    string   `short:"i" description:"name of the module to remove from patch" required:"true" `
}

RemoveModuleCommand removes module information from an existing patch.

func (*RemoveModuleCommand) Execute

func (rmc *RemoveModuleCommand) Execute(args []string) error

type SetModuleCommand

type SetModuleCommand struct {
	GlobalOpts  *Options `no-flag:"true"`
	Module      string   `short:"m" long:"module" description:"name of the module to set patch for"`
	PatchId     string   `short:"i" description:"id of the patch to modify" required:"true" `
	SkipConfirm bool     `short:"y" long:"yes" description:"skip confirmation text"`
	Large       bool     `long:"large" description:"enable submitting larger patches (>16MB)"`
}

SetModuleCommand adds or updates a module in an existing patch.

func (*SetModuleCommand) Execute

func (smc *SetModuleCommand) Execute(args []string) error

type ValidateCommand

type ValidateCommand struct {
	GlobalOpts *Options `no-flag:"true"`
	Positional struct {
		FileName string `positional-arg-name:"filename" description:"path to an evergreen project file"`
	} `positional-args:"1" required:"yes"`
}

ValidateCommand is used to verify that a config file is valid.

func (*ValidateCommand) Execute

func (vc *ValidateCommand) Execute(args []string) error

type VersionCommand

type VersionCommand struct{}

VersionCommand prints the revision that the CLI binary was built with. Is used by auto-update to verify the new version.

func (*VersionCommand) Execute

func (vc *VersionCommand) Execute(args []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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