Skip to content

Commit

Permalink
fix(action): add coreboot blobs into GetSources
Browse files Browse the repository at this point in the history
- with this patch, changes to any blob will also trigger a rebuild

Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Jan 6, 2025
1 parent 3d6789e commit a2a97c1
Showing 1 changed file with 35 additions and 0 deletions.
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

0 comments on commit a2a97c1

Please sign in to comment.