Documentation ¶
Index ¶
- Variables
- func BuildOciImage(config, repo, targetImageName, baseImage, imagePath string) error
- func Clean(dryrun, scan bool, threshold int, dbPath, config string) error
- func CopyFile(source string, target string) error
- func CreateDirectory(path string) error
- func GetVersionFromPath(repoPath string) []string
- func GunZipFile(gzipFile io.Reader) *gzip.Reader
- func MakeExecuteable(path string) error
- func OutputDbStatus() error
- func PopulateLatestMap(bm *BMConfig) map[string]BinmanRelease
- func SetBaseConfig(configArg string) string
- func SetStopMessage(out map[string][]BinmanMsg) string
- func WatchServe(bm *BMConfig)
- func WriteStringtoFile(path string, thestring string) error
- func XunZipFile(xzipFile io.Reader) *xz.Reader
- type Action
- type BMConfig
- func (config *BMConfig) BMClose()
- func (config *BMConfig) CollectData()
- func (config *BMConfig) GetRelease(repo string) (BinmanRelease, error)
- func (config *BMConfig) SetConfig(merge bool) *BMConfig
- func (config *BMConfig) SetDefaults()
- func (config *BMConfig) WithDb(dbConfig ...db.DbConfig) *BMConfig
- func (config *BMConfig) WithDownloader() *BMConfig
- func (config *BMConfig) WithOutput(table, spinner bool) *BMConfig
- func (config *BMConfig) WithWatch() *BMConfig
- type BinmanConfig
- type BinmanDefaults
- type BinmanMsg
- type BinmanQuery
- type BinmanQueryResponse
- type BinmanRelease
- func (r *BinmanRelease) AddCleanArchive() Action
- func (r *BinmanRelease) AddDownloadAction() Action
- func (r *BinmanRelease) AddEndWorkAction() Action
- func (r *BinmanRelease) AddExtractAction() Action
- func (r *BinmanRelease) AddFindTargetAction() Action
- func (r *BinmanRelease) AddGetBinmanReleaseAction() Action
- func (r *BinmanRelease) AddGetGHReleaseAction(ghClient *github.Client) Action
- func (r *BinmanRelease) AddGetGLReleaseAction(glClient *gitlab.Client) Action
- func (r *BinmanRelease) AddLinkFileAction() Action
- func (r *BinmanRelease) AddMakeExecuteableAction() Action
- func (r *BinmanRelease) AddOsCommandAction(index int) Action
- func (r *BinmanRelease) AddReleaseStatusAction(releasePath string) Action
- func (r *BinmanRelease) AddSetArtifactPathAction(releasePath, binPath string) Action
- func (r *BinmanRelease) AddSetFinalActions() Action
- func (r *BinmanRelease) AddSetOsActions() Action
- func (r *BinmanRelease) AddSetPostActions() Action
- func (r *BinmanRelease) AddSetUrlAction() Action
- func (r *BinmanRelease) AddUpdateDbAction() Action
- func (r *BinmanRelease) AddWriteRelNotesAction() Action
- func (r *BinmanRelease) FetchReleaseData(versions ...string) error
- func (r *BinmanRelease) SetSource(sourceMap map[string]*Source)
- type CleanArchiveAction
- type DownloadAction
- type EndWorkAction
- type ExtractAction
- type FindTargetAction
- type GetBinmanReleaseAction
- type GetGHReleaseAction
- type GetGLReleaseAction
- type LinkFileAction
- type MakeExecuteableAction
- type OsCommandAction
- type OutputOptions
- type PostCommand
- type ReleaseStatusAction
- type SetArtifactPathAction
- type SetFinalActions
- type SetOsActions
- type SetPostActions
- type SetUrlAction
- type Source
- type UpdateDbAction
- type UpxConfig
- type Watch
- type WriteRelNotesAction
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("Release not found") ErrBadRequest = errors.New("Bad Request") ErrUnknown = errors.New("Unknown Failure") )
var (
ErrNoVersionsFound = errors.New("No Versions detected for release")
)
var (
ErrReleaseNotFound = errors.New("Requested release not found in config")
)
var ( // ErrVersionsListNotSorted is returned when a list of versions is not sorted ErrVersionsListNotSorted = errors.New("Provided list of versions is not sorted") )
Functions ¶
func BuildOciImage ¶ added in v0.10.2
func CreateDirectory ¶ added in v0.3.0
func GetVersionFromPath ¶ added in v0.11.0
GetVersionFromPath will return a list of all synced versions in a directory path
func MakeExecuteable ¶ added in v0.4.0
func OutputDbStatus ¶ added in v0.10.0
func OutputDbStatus() error
OutputDbStatus will output all keys and values
func PopulateLatestMap ¶ added in v0.11.0
func PopulateLatestMap(bm *BMConfig) map[string]BinmanRelease
func SetBaseConfig ¶ added in v0.2.0
setBaseConfig will check for each of the possible config locations and return the correct value
func SetStopMessage ¶ added in v0.11.0
Set the stop message based on work completed
func WatchServe ¶ added in v0.11.0
func WatchServe(bm *BMConfig)
func WriteStringtoFile ¶ added in v0.2.0
Types ¶
type BMConfig ¶ added in v0.11.0
type BMConfig struct { Config BinmanConfig `yaml:"config"` ConfigPath string `yaml:",omitempty"` Defaults BinmanDefaults `yaml:"defaults,omitempty"` Releases []BinmanRelease `yaml:"releases"` Msgs []BinmanMsg `yaml:",omitempty"` // Output from execution OutputOptions *OutputOptions `yaml:",omitempty"` Metrics *prometheus.GaugeVec // contains filtered or unexported fields }
Type that rolls up the above types into one happy family
func NewBMConfig ¶ added in v0.11.0
func NewBMWatch ¶ added in v0.11.0
For running the default sync
func NewGet ¶ added in v0.11.0
func NewGet(r ...BinmanRelease) *BMConfig
For running the get command
func NewQuery ¶ added in v0.11.0
func NewQuery(r ...BinmanRelease) *BMConfig
This is for when you want to query a single repo
func (*BMConfig) BMClose ¶ added in v0.11.0
func (config *BMConfig) BMClose()
BMClose will close all channels in use
func (*BMConfig) CollectData ¶ added in v0.11.0
func (config *BMConfig) CollectData()
Execute will collect data and execute any requested steps
func (*BMConfig) GetRelease ¶ added in v0.11.0
func (config *BMConfig) GetRelease(repo string) (BinmanRelease, error)
func (*BMConfig) SetConfig ¶ added in v0.11.0
setConfig will create the appropriate BMConfig and merge if required
func (*BMConfig) SetDefaults ¶ added in v0.11.0
func (config *BMConfig) SetDefaults()
SetDefaults will populate defaults, and required values
func (*BMConfig) WithDownloader ¶ added in v0.11.0
func (*BMConfig) WithOutput ¶ added in v0.11.0
WithOutput configures output for an operation
type BinmanConfig ¶ added in v0.0.5
type BinmanConfig struct { CleanupArchive bool `yaml:"cleanup,omitempty"` // mark true if archive should be cleaned after extraction ReleasePath string `yaml:"releasepath,omitempty"` // path to download/link releases from github BinPath string `yaml:"binpath,omitempty"` // path to download/link binaries from github TokenVar string `yaml:"tokenvar,omitempty"` // Github Auth Token NumWorkers int `yaml:"maxdownloads,omitempty"` // maximum number of concurrent downloads the user will allow UpxConfig UpxConfig `yaml:"upx,omitempty"` // Allow upx to shrink extracted Sources []Source `yaml:"sources,omitempty"` // Sources to query. By default gitlab and github Watch Watch `yaml:"watch,omitempty"` // Watch config object SourceMap map[string]*Source `yaml:"-"` // map of names to struct pointers for sources }
BinmanConfig contains Global Config Options
type BinmanDefaults ¶ added in v0.0.5
type BinmanDefaults struct { Os string `yaml:"os,omitempty"` //OS to look for Arch string `yaml:"arch,omitempty"` //architecture to look for Source string `yaml:"source,omitempty"` //Set to binman to override all }
BinmanDefaults contains default config options. If a value is unset in releases array these will be used. This should just be collapsed into BinmanConfig and this struct should be removed
type BinmanMsg ¶ added in v0.0.9
type BinmanMsg struct { Err error Rel BinmanRelease }
BinmanMsg contains return messages for binman's concurrent workers
type BinmanQuery ¶ added in v0.11.0
type BinmanQuery struct { Architechure string `json:"architechure" binding:"required"` Repo string `json:"repo" binding:"required"` Source string `json:"source" binding:"required"` Version string `json:"version"` }
https://gin-gonic.com/docs/examples/binding-and-validation/
func (*BinmanQuery) SendQuery ¶ added in v0.11.0
func (q *BinmanQuery) SendQuery(bmurl string) (BinmanQueryResponse, error)
type BinmanQueryResponse ¶ added in v0.11.0
type BinmanRelease ¶ added in v0.0.5
type BinmanRelease struct { Os string `yaml:"os,omitempty"` Arch string `yaml:"arch,omitempty"` CheckSum bool `yaml:"checkSum,omitempty"` CleanupArchive bool `yaml:"cleanup,omitempty"` // mark true if archive should be cleaned after extraction DownloadOnly bool `yaml:"downloadonly,omitempty"` // Download but do not extract/find/link PostOnly bool `yaml:"postonly,omitempty"` // Gather information from source, but perform no actions save os commands UpxConfig UpxConfig `yaml:"upx,omitempty"` // Allow shrinking with Upx ExternalUrl string `yaml:"url,omitempty"` // User provided external url to use with versions grabbed from GH. Note you must also set ReleaseFileName ExtractFileName string `yaml:"extractfilename,omitempty"` // The file within the release you want ReleaseFileName string `yaml:"releasefilename,omitempty"` // Specifc Release filename to look for. This is useful if a project publishes a binary and not a tarball. Repo string `yaml:"repo"` // The specific repo name in github. e.g achore/syft LinkName string `yaml:"linkname,omitempty"` // Set what the final link will be. Defaults to project name. Version string `yaml:"version,omitempty"` // Pull a specific version PostCommands []PostCommand `yaml:"postcommands,omitempty"` QueryType string `yaml:"querytype,omitempty"` ReleasePath string `yaml:"releasepath,omitempty"` BinPath string `yaml:"binpath,omitempty"` SourceIdentifier string `yaml:"source,omitempty"` // Allow setting of source individually PublishPath string `yaml:"publishpath,omitempty"` // Path Release will be set up at. Typically only set by set commands or library use. ArtifactPath string `yaml:"-"` // Will be set by BinmanRelease.setPaths. This is the source path for the link aka the executable binary // contains filtered or unexported fields }
BinmanRelease contains info on specifc releases to hunt for
func (*BinmanRelease) AddCleanArchive ¶ added in v0.6.0
func (r *BinmanRelease) AddCleanArchive() Action
func (*BinmanRelease) AddDownloadAction ¶ added in v0.1.5
func (r *BinmanRelease) AddDownloadAction() Action
func (*BinmanRelease) AddEndWorkAction ¶ added in v0.5.3
func (r *BinmanRelease) AddEndWorkAction() Action
func (*BinmanRelease) AddExtractAction ¶ added in v0.1.5
func (r *BinmanRelease) AddExtractAction() Action
func (*BinmanRelease) AddFindTargetAction ¶ added in v0.1.5
func (r *BinmanRelease) AddFindTargetAction() Action
func (*BinmanRelease) AddGetBinmanReleaseAction ¶ added in v0.11.0
func (r *BinmanRelease) AddGetBinmanReleaseAction() Action
func (*BinmanRelease) AddGetGHReleaseAction ¶ added in v0.3.0
func (r *BinmanRelease) AddGetGHReleaseAction(ghClient *github.Client) Action
func (*BinmanRelease) AddGetGLReleaseAction ¶ added in v0.8.0
func (r *BinmanRelease) AddGetGLReleaseAction(glClient *gitlab.Client) Action
func (*BinmanRelease) AddLinkFileAction ¶ added in v0.1.5
func (r *BinmanRelease) AddLinkFileAction() Action
func (*BinmanRelease) AddMakeExecuteableAction ¶ added in v0.1.5
func (r *BinmanRelease) AddMakeExecuteableAction() Action
func (*BinmanRelease) AddOsCommandAction ¶ added in v0.1.5
func (r *BinmanRelease) AddOsCommandAction(index int) Action
func (*BinmanRelease) AddReleaseStatusAction ¶ added in v0.3.0
func (r *BinmanRelease) AddReleaseStatusAction(releasePath string) Action
func (*BinmanRelease) AddSetArtifactPathAction ¶ added in v0.3.0
func (r *BinmanRelease) AddSetArtifactPathAction(releasePath, binPath string) Action
func (*BinmanRelease) AddSetFinalActions ¶ added in v0.5.3
func (r *BinmanRelease) AddSetFinalActions() Action
func (*BinmanRelease) AddSetOsActions ¶ added in v0.5.3
func (r *BinmanRelease) AddSetOsActions() Action
func (*BinmanRelease) AddSetPostActions ¶ added in v0.5.3
func (r *BinmanRelease) AddSetPostActions() Action
func (*BinmanRelease) AddSetUrlAction ¶ added in v0.3.0
func (r *BinmanRelease) AddSetUrlAction() Action
func (*BinmanRelease) AddUpdateDbAction ¶ added in v0.10.0
func (r *BinmanRelease) AddUpdateDbAction() Action
func (*BinmanRelease) AddWriteRelNotesAction ¶ added in v0.1.5
func (r *BinmanRelease) AddWriteRelNotesAction() Action
func (*BinmanRelease) FetchReleaseData ¶ added in v0.11.0
func (r *BinmanRelease) FetchReleaseData(versions ...string) error
FetchReleaseData will query the DB
func (*BinmanRelease) SetSource ¶ added in v0.11.0
func (r *BinmanRelease) SetSource(sourceMap map[string]*Source)
SetSource will set the source for a release, it will also trim the source prefix from repo if used
type CleanArchiveAction ¶ added in v0.6.0
type CleanArchiveAction struct {
// contains filtered or unexported fields
}
Remove downloaded archive after extraction
type DownloadAction ¶ added in v0.1.5
type DownloadAction struct {
// contains filtered or unexported fields
}
type EndWorkAction ¶ added in v0.5.3
type EndWorkAction struct {
// contains filtered or unexported fields
}
type ExtractAction ¶ added in v0.1.5
type ExtractAction struct {
// contains filtered or unexported fields
}
Extract
type FindTargetAction ¶ added in v0.1.5
type FindTargetAction struct {
// contains filtered or unexported fields
}
FindTarget
type GetBinmanReleaseAction ¶ added in v0.11.0
type GetBinmanReleaseAction struct {
// contains filtered or unexported fields
}
type GetGHReleaseAction ¶ added in v0.3.0
type GetGHReleaseAction struct {
// contains filtered or unexported fields
}
type GetGLReleaseAction ¶ added in v0.8.0
type GetGLReleaseAction struct {
// contains filtered or unexported fields
}
type LinkFileAction ¶ added in v0.1.5
type LinkFileAction struct {
// contains filtered or unexported fields
}
type MakeExecuteableAction ¶ added in v0.1.5
type MakeExecuteableAction struct {
// contains filtered or unexported fields
}
type OsCommandAction ¶ added in v0.1.5
type OsCommandAction struct {
// contains filtered or unexported fields
}
type OutputOptions ¶ added in v0.11.0
func NewOutputOptions ¶ added in v0.11.0
func NewOutputOptions(table, spinner bool) *OutputOptions
Set table for Table based output after since, if a spinner is needed by the operation set Spinner
func (*OutputOptions) SendSpin ¶ added in v0.11.0
func (o *OutputOptions) SendSpin(s string)
type PostCommand ¶ added in v0.1.5
type ReleaseStatusAction ¶ added in v0.3.0
type ReleaseStatusAction struct {
// contains filtered or unexported fields
}
type SetArtifactPathAction ¶ added in v0.3.0
type SetArtifactPathAction struct {
// contains filtered or unexported fields
}
type SetFinalActions ¶ added in v0.5.3
type SetFinalActions struct {
// contains filtered or unexported fields
}
type SetOsActions ¶ added in v0.5.3
type SetOsActions struct {
// contains filtered or unexported fields
}
type SetPostActions ¶ added in v0.5.3
type SetPostActions struct {
// contains filtered or unexported fields
}
type SetUrlAction ¶ added in v0.3.0
type SetUrlAction struct {
// contains filtered or unexported fields
}
type UpdateDbAction ¶ added in v0.10.0
type UpdateDbAction struct {
// contains filtered or unexported fields
}
type Watch ¶ added in v0.9.0
type Watch struct { Sync bool `yaml:"sync,omitempty"` // set to true if you want to also pull down releases Frequency int `yaml:"frequency,omitempty"` // how often to query for new releases Port string `yaml:"port,omitempty"` // port to expose server mode on FileServer bool `yaml:"fileserver,omitempty"` // Start file server of configured release path, must be used in conjunction with sync LatestVersionMap map[string]BinmanRelease // contains filtered or unexported fields }
type WriteRelNotesAction ¶ added in v0.1.5
type WriteRelNotesAction struct {
// contains filtered or unexported fields
}
WriteReleaseNotes