models

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeMetadata           = "metadata"
	ScopeActions            = "actions"
	ScopeAttestations       = "attestations"
	ScopeChecks             = "checks"
	ScopeContents           = "contents"
	ScopeDeployments        = "deployments"
	ScopeIDToken            = "id-token"
	ScopeIssues             = "issues"
	ScopeDiscussions        = "discussions"
	ScopePackages           = "packages"
	ScopePages              = "pages"
	ScopePullRequests       = "pull-requests"
	ScopeRepositoryProjects = "repository-projects"
	ScopeSecurityEvents     = "security-events"
	ScopeStatuses           = "statuses"

	PermissionRead  = "read"
	PermissionWrite = "write"
	PermissionNone  = "none"
)
View Source
const AllSecrets = "*ALL"

Variables

Functions

This section is empty.

Types

type Config added in v0.10.0

type Config struct {
	Skip        []ConfigSkip    `json:"skip"`
	Include     []ConfigInclude `json:"include"`
	IgnoreForks bool            `json:"ignore_forks,omitempty"`
}

func DefaultConfig added in v0.10.0

func DefaultConfig() *Config

type ConfigInclude added in v0.10.0

type ConfigInclude struct {
	Path StringList `json:"path,omitempty"`
}

type ConfigSkip added in v0.10.0

type ConfigSkip struct {
	Purl  StringList `json:"purl,omitempty"`
	Path  StringList `json:"path,omitempty"`
	Rule  StringList `json:"rule,omitempty"`
	OsvId StringList `json:"osv_id,omitempty"`
	Job   StringList `json:"job,omitempty"`
	Level StringList `json:"level,omitempty"`
}

type GithubActionsEnv

type GithubActionsEnv struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GithubActionsEnvs

type GithubActionsEnvs []GithubActionsEnv

func (*GithubActionsEnvs) UnmarshalYAML

func (o *GithubActionsEnvs) UnmarshalYAML(node *yaml.Node) error

type GithubActionsEvent

type GithubActionsEvent struct {
	Name           string               `json:"name"`
	Types          StringList           `json:"types"`
	Branches       StringList           `json:"branches"`
	BranchesIgnore StringList           `json:"branches_ignore"`
	Paths          StringList           `json:"paths"`
	PathsIgnore    StringList           `json:"paths_ignore"`
	Tags           StringList           `json:"tags"`
	TagsIgnore     StringList           `json:"tags_ignore"`
	Cron           StringList           `json:"cron"`
	Inputs         GithubActionsInputs  `json:"inputs"`
	Outputs        GithubActionsOutputs `json:"outputs"`
	Secrets        GithubActionsSecrets `json:"secrets"`
	Workflows      StringList           `json:"workflows"`
}

type GithubActionsEvents

type GithubActionsEvents []GithubActionsEvent

func (*GithubActionsEvents) UnmarshalYAML

func (o *GithubActionsEvents) UnmarshalYAML(node *yaml.Node) error

type GithubActionsInput

type GithubActionsInput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
	Type        string `json:"type"`
}

type GithubActionsInputs

type GithubActionsInputs []GithubActionsInput

func (*GithubActionsInputs) UnmarshalYAML

func (o *GithubActionsInputs) UnmarshalYAML(node *yaml.Node) error

type GithubActionsJob

type GithubActionsJob struct {
	ID                string                       `json:"id"`
	Name              string                       `json:"name"`
	Uses              string                       `json:"uses"`
	Secrets           GithubActionsJobSecrets      `json:"secrets"`
	With              GithubActionsWith            `json:"with"`
	Permissions       GithubActionsPermissions     `json:"permissions"`
	Needs             StringList                   `json:"needs"`
	If                string                       `json:"if"`
	RunsOn            GithubActionsJobRunsOn       `json:"runs_on" yaml:"runs-on"`
	Container         GithubActionsJobContainer    `json:"container"`
	Environment       GithubActionsJobEnvironments `json:"environment"`
	Outputs           GithubActionsEnvs            `json:"outputs"`
	Env               GithubActionsEnvs            `json:"env"`
	Steps             GithubActionsSteps           `json:"steps"`
	ReferencesSecrets []string                     `json:"references_secrets" yaml:"-"`
	Line              int                          `json:"line" yaml:"-"`

	Lines map[string]int `json:"lines" yaml:"-"`
}

type GithubActionsJobContainer

type GithubActionsJobContainer struct {
	Image string `json:"image"`
}

func (*GithubActionsJobContainer) UnmarshalYAML

func (o *GithubActionsJobContainer) UnmarshalYAML(node *yaml.Node) error

type GithubActionsJobEnvironment

type GithubActionsJobEnvironment struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type GithubActionsJobEnvironments

type GithubActionsJobEnvironments []GithubActionsJobEnvironment

func (*GithubActionsJobEnvironments) UnmarshalYAML added in v0.10.0

func (o *GithubActionsJobEnvironments) UnmarshalYAML(node *yaml.Node) error

type GithubActionsJobRunsOn

type GithubActionsJobRunsOn StringList

func (*GithubActionsJobRunsOn) UnmarshalYAML

func (o *GithubActionsJobRunsOn) UnmarshalYAML(node *yaml.Node) error

type GithubActionsJobSecret

type GithubActionsJobSecret struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GithubActionsJobSecrets

type GithubActionsJobSecrets []GithubActionsJobSecret

func (*GithubActionsJobSecrets) UnmarshalYAML

func (o *GithubActionsJobSecrets) UnmarshalYAML(node *yaml.Node) error

type GithubActionsJobs

type GithubActionsJobs []GithubActionsJob

func (*GithubActionsJobs) UnmarshalYAML

func (o *GithubActionsJobs) UnmarshalYAML(node *yaml.Node) error

type GithubActionsMetadata

type GithubActionsMetadata struct {
	Path        string               `json:"path"`
	Name        string               `json:"name" yaml:"name"`
	Description string               `json:"description" yaml:"description"`
	Author      string               `json:"author" yaml:"author"`
	Inputs      GithubActionsInputs  `json:"inputs"`
	Outputs     GithubActionsOutputs `json:"outputs"`
	Runs        struct {
		Using          string             `json:"using"`
		Main           string             `json:"main"`
		Pre            string             `json:"pre"`
		PreIf          string             `json:"pre-if"`
		Post           string             `json:"post"`
		PostIf         string             `json:"post-if"`
		Steps          GithubActionsSteps `json:"steps"`
		Image          string             `json:"image"`
		Entrypoint     string             `json:"entrypoint"`
		PreEntrypoint  string             `json:"pre-entrypoint"`
		PostEntrypoint string             `json:"post-entrypoint"`
		Args           []string           `json:"args"`
	} `json:"runs"`
}

func (GithubActionsMetadata) IsValid

func (o GithubActionsMetadata) IsValid() bool

type GithubActionsOutput

type GithubActionsOutput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Value       string `json:"value"`
}

type GithubActionsOutputs

type GithubActionsOutputs []GithubActionsOutput

func (*GithubActionsOutputs) UnmarshalYAML

func (o *GithubActionsOutputs) UnmarshalYAML(node *yaml.Node) error

type GithubActionsPermission

type GithubActionsPermission struct {
	Scope      string `json:"scope"`
	Permission string `json:"permission"`
}

type GithubActionsPermissions

type GithubActionsPermissions []GithubActionsPermission

func (*GithubActionsPermissions) UnmarshalYAML

func (o *GithubActionsPermissions) UnmarshalYAML(node *yaml.Node) error

type GithubActionsSecrets

type GithubActionsSecrets = GithubActionsInputs

type GithubActionsStep

type GithubActionsStep struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	If               string            `json:"if"`
	Env              GithubActionsEnvs `json:"env"`
	Uses             string            `json:"uses"`
	Shell            string            `json:"shell"`
	Run              string            `json:"run" yaml:"run"`
	WorkingDirectory string            `json:"working_directory" yaml:"working-directory"`
	With             GithubActionsWith `json:"with"`
	WithRef          string            `json:"with_ref" yaml:"-"`
	WithScript       string            `json:"with_script" yaml:"-"`
	Line             int               `json:"line" yaml:"-"`
	Action           string            `json:"action" yaml:"-"`

	Lines map[string]int `json:"lines" yaml:"-"`
}

func (*GithubActionsStep) UnmarshalYAML

func (o *GithubActionsStep) UnmarshalYAML(node *yaml.Node) error

type GithubActionsSteps

type GithubActionsSteps []GithubActionsStep

type GithubActionsWith

type GithubActionsWith = GithubActionsEnvs

type GithubActionsWorkflow

type GithubActionsWorkflow struct {
	Path        string                   `json:"path" yaml:"-"`
	Name        string                   `json:"name"`
	Events      GithubActionsEvents      `json:"events" yaml:"on"`
	Permissions GithubActionsPermissions `json:"permissions"`
	Env         GithubActionsEnvs        `json:"env"`
	Jobs        GithubActionsJobs        `json:"jobs"`
}

func (GithubActionsWorkflow) IsValid

func (o GithubActionsWorkflow) IsValid() bool

type GitlabciConfig

type GitlabciConfig struct {
	Path      string                  `json:"path"`
	Default   GitlabciJob             `json:"default"`
	Stages    []string                `json:"stages"`
	Variables GitlabciGlobalVariables `json:"variables"`
	Include   GitlabciIncludeItems    `json:"include"`

	Jobs []GitlabciJob      `json:"jobs" yaml:"-"`
	Spec GitlabciConfigSpec `json:"spec" yaml:"-"`
}

https://gitlab.com/gitlab-org/gitlab/-/blob/b95c5fe22ae341370bc5ed34eb78ffecb2133ab1/app/assets/javascripts/editor/schema/ci.json

func ParseGitlabciConfig

func ParseGitlabciConfig(doc []byte) (*GitlabciConfig, error)

func (*GitlabciConfig) UnmarshalYAML

func (o *GitlabciConfig) UnmarshalYAML(node *yaml.Node) error

type GitlabciConfigInput

type GitlabciConfigInput struct {
	Name        string     `json:"name" yaml:"-"`
	Default     string     `json:"default"`
	Description string     `json:"description"`
	Options     StringList `json:"options"`
	Regex       string     `json:"regex"`
}

type GitlabciConfigInputs

type GitlabciConfigInputs []GitlabciConfigInput

func (*GitlabciConfigInputs) UnmarshalYAML

func (o *GitlabciConfigInputs) UnmarshalYAML(node *yaml.Node) error

type GitlabciConfigSpec

type GitlabciConfigSpec struct {
	Inputs GitlabciConfigInputs `json:"inputs"`
}

type GitlabciGlobalVariable

type GitlabciGlobalVariable struct {
	Name        string   `json:"name"`
	Value       string   `json:"value"`
	Options     []string `json:"options"`
	Description string   `json:"description"`
	Expand      bool     `json:"expand"`
}

type GitlabciGlobalVariables

type GitlabciGlobalVariables []GitlabciGlobalVariable

func (*GitlabciGlobalVariables) UnmarshalYAML

func (o *GitlabciGlobalVariables) UnmarshalYAML(node *yaml.Node) error

type GitlabciImage

type GitlabciImage struct {
	Name       string   `json:"name"`
	Entrypoint []string `json:"entrypoint"`
	Docker     struct {
		Platform string `json:"platform"`
		User     string `json:"user"`
	} `json:"docker"`
}

func (*GitlabciImage) UnmarshalYAML

func (o *GitlabciImage) UnmarshalYAML(node *yaml.Node) error

type GitlabciIncludeInput

type GitlabciIncludeInput struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GitlabciIncludeInputs

type GitlabciIncludeInputs []GitlabciIncludeInput

func (*GitlabciIncludeInputs) UnmarshalYAML

func (o *GitlabciIncludeInputs) UnmarshalYAML(node *yaml.Node) error

type GitlabciIncludeItem

type GitlabciIncludeItem struct {
	Local     string                `json:"local,omitempty"`
	Remote    string                `json:"remote,omitempty"`
	Template  string                `json:"template,omitempty"`
	Project   string                `json:"project,omitempty"`
	File      StringList            `json:"file,omitempty"`
	Ref       string                `json:"ref,omitempty"`
	Component string                `json:"component,omitempty"`
	Inputs    GitlabciIncludeInputs `json:"inputs,omitempty"`
}

func (*GitlabciIncludeItem) UnmarshalYAML

func (o *GitlabciIncludeItem) UnmarshalYAML(node *yaml.Node) error

type GitlabciIncludeItems

type GitlabciIncludeItems []GitlabciIncludeItem

func (*GitlabciIncludeItems) UnmarshalYAML

func (o *GitlabciIncludeItems) UnmarshalYAML(node *yaml.Node) error

type GitlabciJob

type GitlabciJob struct {
	Name         string               `json:"name" yaml:"-"`
	Hidden       bool                 `json:"hidden" yaml:"-"`
	Stage        StringList           `json:"stage"`
	Image        GitlabciImage        `json:"image"`
	Services     []GitlabciService    `json:"services"`
	BeforeScript []GitlabciScript     `json:"before_script" yaml:"before_script"`
	AfterScript  []GitlabciScript     `json:"after_script" yaml:"after_script"`
	Script       []GitlabciScript     `json:"script"`
	Variables    GitlabciJobVariables `json:"variables"`
	Hooks        GitlabciJobHooks     `json:"hooks"`
	Inherit      StringList           `json:"inherit"`
	Line         int                  `json:"line" yaml:"-"`
}

type GitlabciJobHooks

type GitlabciJobHooks struct {
	PreGetSourcesScript StringList `json:"pre_get_sources_script"`
}

type GitlabciJobVariable

type GitlabciJobVariable struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Expand bool   `json:"expand"`
}

type GitlabciJobVariables

type GitlabciJobVariables []GitlabciJobVariable

func (*GitlabciJobVariables) UnmarshalYAML

func (o *GitlabciJobVariables) UnmarshalYAML(node *yaml.Node) error

type GitlabciScript

type GitlabciScript struct {
	Run  GitlabciStringRef `json:"run" yaml:"-"`
	Line int               `json:"line" yaml:"-"`
}

func (*GitlabciScript) UnmarshalYAML

func (o *GitlabciScript) UnmarshalYAML(node *yaml.Node) error

type GitlabciService

type GitlabciService struct {
	Name       string   `json:"name"`
	Entrypoint []string `json:"entrypoint"`
	Docker     struct {
		Platform string `json:"platform"`
		User     string `json:"user"`
	} `json:"docker"`
	Command   []string             `json:"command"`
	Alias     string               `json:"alias"`
	Variables GitlabciJobVariables `json:"variables"`
}

type GitlabciStringRef

type GitlabciStringRef string

func (*GitlabciStringRef) UnmarshalYAML

func (o *GitlabciStringRef) UnmarshalYAML(node *yaml.Node) error

type PackageInsights

type PackageInsights struct {
	Version string `json:"version"`

	FirstSeenAt    string `json:"first_seen_at"`
	UpdatedAt      string `json:"updated_at"`
	LastCommitedAt string `json:"last_commited_at"`

	Purl string `json:"purl"`

	AnalysisResult   string `json:"analysis_result"`
	AnalysisDetails  string `json:"analysis_details"`
	PackageEcosystem string `json:"package_ecosystem"`
	PackageName      string `json:"package_name"`
	PackageNamespace string `json:"package_namespace"`
	PackageVersion   string `json:"package_version"`

	SourceScmType      string `json:"source_scm_type"`
	SourceGitRepo      string `json:"source_git_repo"`
	SourceGitRepoPath  string `json:"source_git_repo_path"`
	SourceGitRef       string `json:"source_git_ref"`
	SourceGitCommitSha string `json:"source_git_commit_sha"`

	PackageDependencies []string `json:"package_dependencies"`
	BuildDependencies   []string `json:"build_dependencies"`

	GithubActionsWorkflows []GithubActionsWorkflow `json:"github_actions_workflows"`
	GithubActionsMetadata  []GithubActionsMetadata `json:"github_actions_metadata"`

	GitlabciConfigs []GitlabciConfig `json:"gitlabci_configs"`
}

func (*PackageInsights) GetSourceGitRepoURI

func (p *PackageInsights) GetSourceGitRepoURI() string

func (*PackageInsights) NormalizePurl

func (p *PackageInsights) NormalizePurl() error

type Purl

type Purl struct {
	packageurl.PackageURL
}

func NewPurl

func NewPurl(purl string) (Purl, error)

func PurlFromDockerImage

func PurlFromDockerImage(image string) (Purl, error)

func PurlFromGithubActions

func PurlFromGithubActions(uses string) (Purl, error)

func (*Purl) FullName

func (p *Purl) FullName() string
func (p *Purl) Link() string

func (*Purl) Normalize

func (p *Purl) Normalize()

type StringList

type StringList []string

func (*StringList) UnmarshalYAML

func (o *StringList) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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