publish

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPages

func BuildPages(projectDir string, allReports map[int]constants.Year) error

BuildPages will generate all the pages required for GitHub Pages.

func CopyResultsFileIntoPages

func CopyResultsFileIntoPages(gitDir, filename string, resultsFile *os.File) error

CopyResultsFileIntoPages copies the results of the recent scan into the relevant location for the static site to be able to display them.

func FetchExistingReports

func FetchExistingReports(gitDir string) ([]string, error)

FetchExistingReports runs to collect all reports from the results directory so that they can be parsed for later usage.

func FetchPagesRepo

func FetchPagesRepo(o *flags.PublishOptions) (string, *git.Repository, error)

FetchPagesRepo pulls the GitHub pages repo locally for modification.

func GenerateHTMLTemplate

func GenerateHTMLTemplate(baseDir string, allReports map[int]constants.Year) error

GenerateHTMLTemplate creates the index.html page for the frontend website which displays the CVE data.

func GenerateJSTemplates

func GenerateJSTemplates(baseDir string, allReports map[int]constants.Year) error

GenerateJSTemplates creates all the Javscript files for the frontend website.

func NewPublishCommand

func NewPublishCommand() *cobra.Command

NewPublishCommand creates a command that publishes CVE data to GitHub Pages - this will be deprecated soon

func PagesCleanup

func PagesCleanup(pagesDir string)

PagesCleanup just removes any leftover files/repo so that when running locally the binary doesn't hit a conflict. This ensures that on multiple runs it always ahas the latest code base for the GitHub pages repo.

func ParseReports

func ParseReports(reports []string, img *Image) (map[int]constants.Year, error)

ParseReports turns all json files into structs to be used in templating for the static site.

func PublishPages

func PublishPages(repository *git.Repository, gitPagesPath string) error

PublishPages pushes the generated javascript, html and results file to GitHub pages.

Types

type Image

type Image struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	MinDisk   int    `json:"min_disk"`
	MinRAM    int    `json:"min_ram"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	UpdatedAt string `json:"updated_at"`
}

Image represents an Image returned by the Compute API.

func GetImageData

func GetImageData(client *ostack.Client, imgID string) *Image

GetImageData pulls data on the image for naming the report.

Jump to

Keyboard shortcuts

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