repos

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RepoConfigFileName is the expected name of the configuration
	// file for a TTP repository such as ForgeArmory.
	// We export it for tests
	RepoConfigFileName = "ttpforge-repo-config.yaml"

	// RepoPrefixSep divides the repo name reference from the TTP/template/etc path
	RepoPrefixSep = "//"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitConfig

type GitConfig struct {
	URL    string `yaml:"url"`
	Branch string `yaml:"branch,omitempty"`
}

GitConfig provides instructions for cloning a repo

type Repo

type Repo interface {
	ListTTPs() ([]string, error)
	FindTTP(ttpPath string) (string, error)
	FindTemplate(templatePath string) (string, error)
	GetFs() afero.Fs
	GetName() string
	GetFullPath() string
}

Repo provides an interface for finding TTPs and templates from a repo such as ForgeArmory

type RepoCollection added in v1.0.1

type RepoCollection interface {
	GetRepo(repoName string) (Repo, error)
	ResolveTTPRef(ttpRef string) (Repo, string, error)
	ListTTPs() ([]string, error)
}

RepoCollection provides useful methods for resolving and navigating TTPs stored in various different repositories

func NewRepoCollection added in v1.0.1

func NewRepoCollection(fsys afero.Fs, specs []Spec, basePath string) (RepoCollection, error)

NewRepoCollection validates the provided repo specs and assembles them into a RepoCollection

**Parameters:**

fsys: base file system (used for unit testing) specs: a list of repo.Spec entries (usually from the config file)

**Returns:**

RepoCollection: assembled RepoCollection, or nil if there was an error error: an error if there is a problem

type Spec

type Spec struct {
	Name string    `yaml:"name"`
	Path string    `yaml:"path"`
	Git  GitConfig `yaml:"git"`
}

Spec defines the fields that are expected to be set in the program-wide configuration file in order to add a given repository folder to the TTPForge search path for TTPs, templates, etc

func (*Spec) Load

func (spec *Spec) Load(fsys afero.Fs, basePath string) (Repo, error)

Load will clone a repository if necessary and valdiate its configuration, making it usable to lookup TTPs

Jump to

Keyboard shortcuts

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