utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Images
	NoVulnerabilityBannerSource imageSource = "noVulnerabilityBanner.png"
	VulnerabilitiesBannerSource imageSource = "vulnerabilitiesBanner.png"

	// VCS providers params
	GitHub vcsProvider = "github"
	GitLab vcsProvider = "gitlab"

	// Frogbot label
	LabelName        frogbotLabel = "🐸 frogbot scan"
	LabelDescription frogbotLabel = "triggers frogbot scan"
	LabelColor       frogbotLabel = "4AB548"

	InstallCommandEnv   = "JF_INSTALL_DEPS_CMD"
	WorkingDirectoryEnv = "JF_WORKING_DIR"

	// JFrog platform environment varialbes
	JFrogUserEnv = "JF_USER"
	JFrogUrlEnv  = "JF_URL"

	JFrogPasswordEnv = "JF_PASSWORD"
	JFrogTokenEnv    = "JF_ACCESS_TOKEN"

	// Git environment variables
	GitProvider     = "JF_GIT_PROVIDER"
	GitRepoOwnerEnv = "JF_GIT_OWNER"
	GitRepoEnv      = "JF_GIT_REPO"
	//#nosec G101 -- False positive - no hardcoded credentials.
	GitTokenEnv         = "JF_GIT_TOKEN"
	GitBaseBranchEnv    = "JF_GIT_BASE_BRANCH"
	GitPullRequestIDEnv = "JF_GIT_PULL_REQUEST_ID"
	GitApiEndpointEnv   = "JF_GIT_API_ENDPOINT"
	WatchesDelimiter    = ","

	// Comment
	TableHeder = "\n| SEVERITY | IMPACTED PACKAGE | VERSION | FIXED VERSIONS | COMPONENT | COMPONENT VERSION | CVE\n" +
		":--: | -- | -- | -- | -- | :--: | --"
	WhatIsFrogbotMd = "\n\n[What is Frogbot?](https://github.com/jfrog/frogbot#frogbot)"
)

Variables

This section is empty.

Functions

func AssertSanitizedEnv added in v1.0.1

func AssertSanitizedEnv(t *testing.T)

Make sure the environment variables does not contain any Frogbot variables

func Chdir

func Chdir(dir string) (cbk func(), err error)

func GetBanner

func GetBanner(banner imageSource) string

func GetSeverityTag

func GetSeverityTag(iconName IconName) string

func ReportUsage added in v1.1.0

func ReportUsage(commandName string, serverDetails *config.ServerDetails, usageReportSent chan<- error)

func SetEnvAndAssert added in v1.0.1

func SetEnvAndAssert(t *testing.T, env map[string]string)

Receive an environment variables key-values map, set and assert the enviromnet variables. Return a callback that sets the previous values.

Types

type FrogbotParams

type FrogbotParams struct {
	JFrogEnvParams
	GitParam
	WorkingDirectory   string
	InstallCommandName string
	InstallCommandArgs []string
}

func GetParamsAndClient

func GetParamsAndClient() (*FrogbotParams, vcsclient.VcsClient, error)

type GitParam

type GitParam struct {
	GitProvider   vcsutils.VcsProvider
	RepoOwner     string
	Token         string
	Repo          string
	BaseBranch    string
	ApiEndpoint   string
	PullRequestID int
}

type IconName

type IconName string

type JFrogEnvParams

type JFrogEnvParams struct {
	Server  coreconfig.ServerDetails
	Project string
	Watches string
}

Jump to

Keyboard shortcuts

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