Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(action): add coreboot blobs into GetSources #488

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions action/recipes/coreboot.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,41 @@ func (opts CorebootOpts) GetArtifacts() *[]container.Artifacts {
return opts.CommonOpts.GetArtifacts()
}

// GetSources returns slice of paths to all sources which are used for build
func (opts CorebootOpts) GetSources() []string {
sources := opts.CommonOpts.GetSources()

// Add blobs to list of sources
blobs, err := corebootProcessBlobs(opts.Blobs)
if err != nil {
slog.Error(
"Failed to process all blobs",
slog.Any("error", err),
)
return nil
}

pwd, err := os.Getwd()
if err != nil {
slog.Error(
"Could not get working directory",
slog.String("suggestion", logging.ThisShouldNotHappenMessage),
slog.Any("error", err),
)
return nil
}
for blob := range blobs {
// Path to local file on host
src := filepath.Join(
pwd,
blobs[blob].Path,
)
sources = append(sources, src)
}

return sources
}

// corebootProcessBlobs is used to figure out blobs from provided data
func corebootProcessBlobs(opts CorebootBlobs) ([]BlobDef, error) {
blobMap := map[string]BlobDef{
Expand Down
Loading