export

package
v0.7.6-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chart

func Chart(b []byte, logger *logrus.Logger) error

func GetResult

func GetResult(b []byte, logger *logrus.Logger, cmd string) ([]runner.ShellResult, error)

func HarborImageList

func HarborImageList(b []byte, logger *logrus.Logger) error

HarborImageList harbor镜像列表导出

func Item

func Item(b []byte, logger *logrus.Logger, cmd string) error

func LocalImageList

func LocalImageList()

Types

type Artifact

type Artifact struct {
	AdditionLinks struct {
		BuildHistory struct {
			Absolute bool   `json:"absolute"`
			Href     string `json:"href"`
		} `json:"build_history"`
		Vulnerabilities struct {
			Absolute bool   `json:"absolute"`
			Href     string `json:"href"`
		} `json:"vulnerabilities"`
	} `json:"addition_links"`
	Digest     string `json:"digest"`
	ExtraAttrs struct {
		Architecture string      `json:"architecture"`
		Author       interface{} `json:"author"`
		Created      time.Time   `json:"created"`
		Os           string      `json:"os"`
	} `json:"extra_attrs"`
	Icon              string        `json:"icon"`
	Id                int           `json:"id"`
	Labels            interface{}   `json:"labels"`
	ManifestMediaType string        `json:"manifest_media_type"`
	MediaType         string        `json:"media_type"`
	ProjectId         int           `json:"project_id"`
	PullTime          time.Time     `json:"pull_time"`
	PushTime          time.Time     `json:"push_time"`
	References        interface{}   `json:"references"`
	RepositoryId      int           `json:"repository_id"`
	Size              int           `json:"size"`
	Tags              []TagExternel `json:"tags"`
	Type              string        `json:"type"`
}

type ChartExecutor

type ChartExecutor struct {
	Config ChartRepoConfig
	Logger *logrus.Logger
}

func (ChartExecutor) ChartList

func (executor ChartExecutor) ChartList() ([]ChartItem, error)

ChartList 获取chart列表

func (ChartExecutor) Save

func (executor ChartExecutor) Save(list []ChartItem)

Save 保存chart列表

func (ChartExecutor) SaveChart

func (executor ChartExecutor) SaveChart(dst string, src io.Reader)

type ChartItem

type ChartItem struct {
	Name          string    `json:"name"`
	TotalVersions int       `json:"total_versions"`
	LatestVersion string    `json:"latest_version"`
	Created       time.Time `json:"created"`
	Updated       time.Time `json:"updated"`
	Icon          string    `json:"icon"`
	Home          string    `json:"home"`
	Deprecated    bool      `json:"deprecated"`
}

type ChartRepoConfig

type ChartRepoConfig struct {
	HelmRepo HelmRepo `yaml:"helm-Repository"`
}

ChartRepoConfig chart仓库实体

func ParseHelmRepoConfig

func ParseHelmRepoConfig(b []byte, logger *logrus.Logger) (ChartRepoConfig, error)

type HarborConfig

type HarborConfig struct {
	Schema      string
	Address     string
	Domain      string
	User        string
	Password    string
	PreserveDir string
	Projects    []string
	Excludes    []string
}

type HarborConfigExternel

type HarborConfigExternel struct {
	HarborRepo struct {
		Schema      string   `yaml:"schema"`
		Address     string   `yaml:"address"`
		Domain      string   `yaml:"domain"`
		User        string   `yaml:"user"`
		Password    string   `yaml:"password"`
		PreserveDir string   `yaml:"preserve-dir"`
		Projects    []string `yaml:"projects"`
		Excludes    []string `yaml:"excludes"`
	} `yaml:"harbor-repo"`
}

type HarborExecutor

type HarborExecutor struct {
	HarborConfig   HarborConfig
	Logger         *logrus.Logger
	ProjectSlice   []ProjectInternel
	ReposInProject map[string][]string // 项目下镜像repo集合
	TagsInProject  map[string][]string // 项目下镜像tag集合
}

func ParseHarborConfig

func ParseHarborConfig(b []byte, logger *logrus.Logger) (*HarborExecutor, error)

func (*HarborExecutor) AllProjects

func (executor *HarborExecutor) AllProjects() error

AllProjects 获取harbor所有projects

func (*HarborExecutor) FilterProjects

func (executor *HarborExecutor) FilterProjects() error

FilterProjects 过滤排除的project

func (*HarborExecutor) GenerateImageList

func (executor *HarborExecutor) GenerateImageList() error

GenerateImageList 生成文件

func (*HarborExecutor) ListRepoByPage

func (executor *HarborExecutor) ListRepoByPage(page int, projectName string) ([]Repository, error)

ListRepoByPage 调用harbor api获取project列表,根据project name获取repo列表

func (*HarborExecutor) ProjectList

func (executor *HarborExecutor) ProjectList() error

ProjectList 获取所有projects

func (*HarborExecutor) ProjectsByName

func (executor *HarborExecutor) ProjectsByName(projectName string) (ProjectInternel, error)

ProjectsByName 按名称获取harbor内的项目

func (*HarborExecutor) ProjectsByNames

func (executor *HarborExecutor) ProjectsByNames(projectsName []string) error

ProjectsByNames 按名称集合获取harbor内的项目

func (*HarborExecutor) ProjectsByPage

func (executor *HarborExecutor) ProjectsByPage(page int) ([]ProjectInternel, error)

ProjectsByPage 按页查询harbor内project

func (*HarborExecutor) ReposWithinProject

func (executor *HarborExecutor) ReposWithinProject(projectName string) error

ReposWithinProject 获取项目下repo列表

func (*HarborExecutor) ReposWithinProjects

func (executor *HarborExecutor) ReposWithinProjects() error

func (*HarborExecutor) TagsWithinProject

func (executor *HarborExecutor) TagsWithinProject(projectName string) ([]string, error)

TagsWithinProject 按`project name + Repository name`查询所有镜像tag

func (*HarborExecutor) TagsWithinProjects

func (executor *HarborExecutor) TagsWithinProjects() error

func (*HarborExecutor) TagsWithinRepo

func (executor *HarborExecutor) TagsWithinRepo(projectName string, repoName string) ([]string, error)

TagsWithinRepo 按`project name + Repository name`查询所有镜像tag

func (*HarborExecutor) TagsWithinRepoByPage

func (executor *HarborExecutor) TagsWithinRepoByPage(page int, projectName string, repoName string) ([]string, error)

TagsWithinRepoByPage 获取repo的全部tag

type HelmRepo

type HelmRepo struct {
	Endpoint    string `yaml:"endpoint"`
	Username    string `yaml:"username"`
	Password    string `yaml:"password"`
	PreserveDir string `yaml:"preserveDir"`
	Package     bool   `yaml:"package"`
	RepoName    string `yaml:"Repository-name"`
}

type ProjectExternel

type ProjectExternel struct {
	CreationTime       time.Time `json:"creation_time"`
	CurrentUserRoleId  int       `json:"current_user_role_id"`
	CurrentUserRoleIds []int     `json:"current_user_role_ids"`
	CveAllowlist       struct {
		CreationTime time.Time     `json:"creation_time"`
		Id           int           `json:"id"`
		Items        []interface{} `json:"items"`
		ProjectId    int           `json:"project_id"`
		UpdateTime   time.Time     `json:"update_time"`
	} `json:"cve_allowlist"`
	Metadata struct {
		Public               string `json:"public"`
		RetentionId          string `json:"retention_id,omitempty"`
		AutoScan             string `json:"auto_scan,omitempty"`
		EnableContentTrust   string `json:"enable_content_trust,omitempty"`
		PreventVul           string `json:"prevent_vul,omitempty"`
		ReuseSysCveAllowlist string `json:"reuse_sys_cve_allowlist,omitempty"`
		Severity             string `json:"severity,omitempty"`
	} `json:"metadata"`
	Name       string    `json:"name"`
	OwnerId    int       `json:"owner_id"`
	OwnerName  string    `json:"owner_name"`
	ProjectId  int       `json:"project_id"`
	RepoCount  int       `json:"repo_count,omitempty"`
	UpdateTime time.Time `json:"update_time"`
	ChartCount int       `json:"chart_count,omitempty"`
}

type ProjectInternel

type ProjectInternel struct {
	Name      string
	ProjectId int
}

type Repository

type Repository struct {
	Name string `json:"name"`
}

type SearchResult

type SearchResult struct {
	Project    []ProjectExternel `json:"project"`
	Repository []struct {
	} `json:"repository"`
	Chart []struct {
		Name  string `json:"Name"`
		Score int    `json:"Score"`
		Chart struct {
			Name        string    `json:"name"`
			Version     string    `json:"version"`
			Description string    `json:"description"`
			ApiVersion  string    `json:"apiVersion"`
			AppVersion  string    `json:"appVersion"`
			Type        string    `json:"type"`
			Urls        []string  `json:"urls"`
			Created     time.Time `json:"created"`
			Digest      string    `json:"digest"`
		} `json:"Chart"`
	} `json:"chart"`
}

type TagExternel

type TagExternel struct {
	ArtifactId   int       `json:"artifact_id"`
	Id           int       `json:"id"`
	Immutable    bool      `json:"immutable"`
	Name         string    `json:"name"`
	PullTime     time.Time `json:"pull_time"`
	PushTime     time.Time `json:"push_time"`
	RepositoryId int       `json:"repository_id"`
	Signed       bool      `json:"signed"`
}

Jump to

Keyboard shortcuts

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