diff --git a/pkg/pillar/cmd/zedagent/parseconfig_test.go b/pkg/pillar/cmd/zedagent/parseconfig_test.go index b5f81ad2a25..138b214e0ae 100644 --- a/pkg/pillar/cmd/zedagent/parseconfig_test.go +++ b/pkg/pillar/cmd/zedagent/parseconfig_test.go @@ -1326,10 +1326,11 @@ func TestParsePatchEnvelope(t *testing.T) { AllowedApps: []string{appU1, appU2}, BinaryBlobs: []types.BinaryBlobCompleted{ { - FileName: inlineFileName, - FileSha: hex.EncodeToString(shaBytes[:]), - FileMetadata: fileMetadata, - URL: filepath.Join(persistCacheFolder, inlineFileName), + FileName: inlineFileName, + FileSha: hex.EncodeToString(shaBytes[:]), + FileMetadata: fileMetadata, + ArtifactMetadata: artiactMetadata, + URL: filepath.Join(persistCacheFolder, inlineFileName), }, }, }, diff --git a/pkg/pillar/cmd/zedagent/parsepatchenvelopes.go b/pkg/pillar/cmd/zedagent/parsepatchenvelopes.go index 9abf1d21023..7de80920af7 100644 --- a/pkg/pillar/cmd/zedagent/parsepatchenvelopes.go +++ b/pkg/pillar/cmd/zedagent/parsepatchenvelopes.go @@ -94,6 +94,7 @@ func addBinaryBlobToPatchEnvelope(pe *types.PatchEnvelopeInfo, artifact *zconfig if err != nil { return err } + volumeRef.ArtifactMetadata = artifact.GetArtifactMetaData() pe.VolumeRefs = append(pe.VolumeRefs, *volumeRef) return nil case zconfig.EVE_OPAQUE_OBJECT_CATEGORY_SECRET: @@ -106,6 +107,7 @@ func addBinaryBlobToPatchEnvelope(pe *types.PatchEnvelopeInfo, artifact *zconfig if err != nil { return err } + binaryBlob.ArtifactMetadata = artifact.GetArtifactMetaData() pe.BinaryBlobs = append(pe.BinaryBlobs, *binaryBlob) return nil } diff --git a/pkg/pillar/cmd/zedrouter/patchenvelopes.go b/pkg/pillar/cmd/zedrouter/patchenvelopes.go index 4f4b4f5384f..e097a0f6575 100644 --- a/pkg/pillar/cmd/zedrouter/patchenvelopes.go +++ b/pkg/pillar/cmd/zedrouter/patchenvelopes.go @@ -184,10 +184,11 @@ func blobFromVolRef(vr types.BinaryBlobVolumeRef, vs types.VolumeStatus) (*types return nil, err } return &types.BinaryBlobCompleted{ - FileName: vr.FileName, - FileMetadata: vr.FileMetadata, - FileSha: fmt.Sprintf("%x", sha), - URL: vs.FileLocation, + FileName: vr.FileName, + FileMetadata: vr.FileMetadata, + ArtifactMetadata: vr.ArtifactMetadata, + FileSha: fmt.Sprintf("%x", sha), + URL: vs.FileLocation, }, nil } diff --git a/pkg/pillar/types/patchenvelopestypes.go b/pkg/pillar/types/patchenvelopestypes.go index ec5931c485d..cea6350e2b0 100644 --- a/pkg/pillar/types/patchenvelopestypes.go +++ b/pkg/pillar/types/patchenvelopestypes.go @@ -54,10 +54,13 @@ func (pe *PatchEnvelopeInfoList) FindPatchEnvelopeByID(patchID string) *PatchEnv // BinaryBlobCompleted is representation of // binary blob ready to be downloaded by app instance type BinaryBlobCompleted struct { - FileName string `json:"fileName"` - FileSha string `json:"fileSha"` + FileName string `json:"fileName"` + FileSha string `json:"fileSha"` + // FileMetadata is related to file, i.e. env variables, cli arguments FileMetadata string `json:"fileMetaData"` - URL string `json:"url"` //nolint:var-naming + // ArtifactMetadata is generic info i.e. user info, desc etc. + ArtifactMetadata string `json:"artifactMetaData"` + URL string `json:"url"` //nolint:var-naming } // CompletedBinaryBlobIdxByName returns index of element in blobs list @@ -75,8 +78,11 @@ func CompletedBinaryBlobIdxByName(blobs []BinaryBlobCompleted, name string) int // external binary blobs, which has not yet been // downloaded type BinaryBlobVolumeRef struct { - FileName string `json:"fileName"` - ImageName string `json:"imageName"` + FileName string `json:"fileName"` + ImageName string `json:"imageName"` + // FileMetadata is related to file, i.e. env variables, cli arguments FileMetadata string `json:"fileMetaData"` - ImageID string `json:"imageId"` + // ArtifactMetadata is generic info i.e. user info, desc etc. + ArtifactMetadata string `json:"artifactMetaData"` + ImageID string `json:"imageId"` } diff --git a/pkg/pillar/utils/patchenvelopesutils_test.go b/pkg/pillar/utils/patchenvelopesutils_test.go index 33c5a406453..cddf2a0a3e9 100644 --- a/pkg/pillar/utils/patchenvelopesutils_test.go +++ b/pkg/pillar/utils/patchenvelopesutils_test.go @@ -29,17 +29,18 @@ func TestGetZipArchive(t *testing.T) { AllowedApps: []string{uuidString}, BinaryBlobs: []types.BinaryBlobCompleted{ { - FileName: "TestFileName", - FileSha: "TestFileSha", - FileMetadata: "TestFileMetadata", - URL: "./testurl", + FileName: "TestFileName", + FileSha: "TestFileSha", + ArtifactMetadata: "TestArtifactMetadata", + FileMetadata: "TestFileMetadata", + URL: "./testurl", }, }, } pe.Envelopes = append(pe.Envelopes, peInfo) - g.Expect(pe.Get(uuidString)).To(gomega.BeEquivalentTo([]types.PatchEnvelopeInfo{peInfo})) + g.Expect(pe.Get(uuidString).Envelopes).To(gomega.BeEquivalentTo([]types.PatchEnvelopeInfo{peInfo})) // Test GetZipArchive root := "./"