pipelinectxt

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ArtifactsDir              = "artifacts"
	ArtifactsPath             = BaseDir + "/" + ArtifactsDir
	PipelineRunsDir           = "pipeline-runs"
	PipelineRunsPath          = ArtifactsPath + "/" + PipelineRunsDir
	ImageDigestsDir           = "image-digests"
	ImageDigestsPath          = ArtifactsPath + "/" + ImageDigestsDir
	SonarAnalysisDir          = "sonarqube-analysis"
	SonarAnalysisPath         = ArtifactsPath + "/" + SonarAnalysisDir
	AquaScansDir              = "aquasec-scans"
	AquaScansPath             = ArtifactsPath + "/" + AquaScansDir
	SBOMsDir                  = "sboms"
	SBOMsPath                 = ArtifactsPath + "/" + SBOMsDir
	SBOMsFormat               = "spdx"
	CodeCoveragesDir          = "code-coverage"
	CodeCoveragesPath         = ArtifactsPath + "/" + CodeCoveragesDir
	XUnitReportsDir           = "xunit-reports"
	XUnitReportsPath          = ArtifactsPath + "/" + XUnitReportsDir
	LintReportsDir            = "lint-reports"
	LintReportsPath           = ArtifactsPath + "/" + LintReportsDir
	DeploymentsDir            = "deployments"
	DeploymentsPath           = ArtifactsPath + "/" + DeploymentsDir
	ArtifactsManifestFilename = "manifest.json"
)
View Source
const (
	BaseDir      = ".ods"
	SubreposDir  = "repos"
	SubreposPath = BaseDir + "/" + SubreposDir
)

Variables

This section is empty.

Functions

func ArtifactGroup

func ArtifactGroup(ctxt *ODSContext, subdir string) string

ArtifactGroup returns the group in which aritfacts are stored for the given ODS pipeline context and the subdir.

func ArtifactGroupBase

func ArtifactGroupBase(ctxt *ODSContext) string

ArtifactGroupBase returns the group base in which aritfacts are stored for the given ODS pipeline context.

func CopyArtifact

func CopyArtifact(sourceFile, artifactsPath string) error

CopyArtifact copies given "sourceFile" into "artifactsPath".

func DetectSubrepos

func DetectSubrepos() ([]fs.DirEntry, error)

DetectSubrepos returns a slice of subrepo directories

func ReadArtifactFilenames

func ReadArtifactFilenames(artifactsPath string) ([]string, error)

ReadArtifactFilenames returns all filenames in artifactsPath. If artifactsPath does not exist, an empty list is returned.

func ReadArtifactFilesIncludingSubrepos

func ReadArtifactFilesIncludingSubrepos(artifactPath string, subrepos []fs.DirEntry) ([]string, error)

ReadArtifactFilesIncludingSubrepos reads artifacts in artifactPath of the current repository and all subrepos given. The returned files include path and filename.

func ReadArtifactsDir

func ReadArtifactsDir(artifactsDir string) (map[string][]string, error)

ReadArtifactsDir reads all artifacts in checkoutDir/ArtifactsPath. Only files in subdirectories are considered as artifacts. Example: [

"xunit-reports": ["report.xml"]
"sonarqube-analysis": ["analysis-report.md", "issues-report.csv"],

]

func WriteGitIgnore

func WriteGitIgnore(path string) error

func WriteJsonArtifact

func WriteJsonArtifact(in interface{}, artifactsPath, filename string) error

WriteJsonArtifact marshals given "in" struct and writes it into "artifactsPath" as "filename".

Types

type ArtifactInfo

type ArtifactInfo struct {
	URL       string `json:"url"`
	Directory string `json:"directory"`
	Name      string `json:"name"`
}

ArtifactInfo represents one artifact.

type ArtifactsManifest

type ArtifactsManifest struct {
	// Repository is the artifact repository from which the manifests were downloaded.
	Repository string `json:"repository"`
	// Artifacts lists all artifacts downloaded.
	Artifacts []ArtifactInfo `json:"artifacts"`
}

ArtifactsManifest represents all downloaded artifacts.

func DownloadGroup

func DownloadGroup(
	nexusClient nexus.ClientInterface,
	repository, group, artifactsDir string,
	logger logging.LeveledLoggerInterface) (*ArtifactsManifest, error)

DownloadGroup searches given repositories in order for assets in given group. As soon as one repository has any asset in the group, the search is stopped and all found artifacts are downloaded into artifactsDir. An artifacts manifest is returned describing the downloaded files. When none of the given repositories contains any artifacts under the group, no artifacts are downloaded and no error is returned. If artifactsDir is an empty string, the searched files are not downloaded but the artifacts are still recorded in the returned manifest.

func NewArtifactsManifest

func NewArtifactsManifest(repository string, artifacts ...ArtifactInfo) *ArtifactsManifest

NewArtifactsManifest returns a new ArtifactsManifest instance.

func ReadArtifactsManifestFromFile

func ReadArtifactsManifestFromFile(filename string) (*ArtifactsManifest, error)

ReadArtifactsManifestFromFile reads an artifact manifest from given filename or errors.

func (*ArtifactsManifest) Contains

func (am *ArtifactsManifest) Contains(repository, directory, name string) bool

Contains checks whether given directory/name is already present in repository.

type ODSContext

type ODSContext struct {
	Project         string
	Repository      string
	Component       string
	Namespace       string
	GitCommitSHA    string
	GitFullRef      string
	GitRef          string
	GitURL          string
	PullRequestBase string
	PullRequestKey  string
}

func NewFromCache

func NewFromCache(wsDir string) (o *ODSContext, err error)

func (*ODSContext) Assemble

func (o *ODSContext) Assemble(wsDir string) error

Assemble builds an ODS context based on given wsDir directory. The information is gathered from the .git directory.

func (*ODSContext) Copy

func (o *ODSContext) Copy() *ODSContext

func (*ODSContext) ReadCache

func (o *ODSContext) ReadCache(wsDir string) error

ReadCache reads ODS context from .ods TODO: test that this works

func (*ODSContext) WriteCache

func (o *ODSContext) WriteCache(wsDir string) error

WriteCache writes the ODS context to .ods

Jump to

Keyboard shortcuts

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