44 "encoding/json"
55 "fmt"
66 "net/http"
7+ "runtime"
78 "strings"
89
910 xrayUtils "github.com/jfrog/jfrog-client-go/xray/services/utils"
@@ -12,6 +13,7 @@ import (
1213 "github.com/jfrog/jfrog-client-go/artifactory"
1314 "github.com/jfrog/jfrog-client-go/auth"
1415 "github.com/jfrog/jfrog-client-go/utils/io/httputils"
16+ "github.com/jfrog/jfrog-client-go/utils/log"
1517
1618 "github.com/jfrog/jfrog-cli-core/v2/common/project"
1719 "github.com/jfrog/jfrog-cli-core/v2/utils/config"
@@ -93,13 +95,17 @@ func getMultiArchShaRefs(params technologies.BuildInfoBomGeneratorParams, repo,
9395 return nil
9496 }
9597
96- shaRefs := make ([]string , 0 , len (manifestList .Manifests ))
98+ // Find the manifest matching the current architecture
99+ currentArch := runtime .GOARCH
97100 for _ , manifest := range manifestList .Manifests {
98- if manifest .Digest != "" {
99- shaRefs = append (shaRefs , dockerPackagePrefix + pkgName + ":" + manifest .Digest )
101+ if manifest .Digest != "" && manifest .Platform .Architecture == currentArch {
102+ log .Debug ("Found matching Docker architecture %s, digest: %s" , currentArch , manifest .Digest )
103+ return []string {dockerPackagePrefix + pkgName + ":" + manifest .Digest }
100104 }
101105 }
102- return shaRefs
106+
107+ log .Debug ("No matching Docker architecture found for %s, checking all manifests" , currentArch )
108+ return nil
103109}
104110
105111func buildManifestUrl (serverDetails * config.ServerDetails , repo , pkgName , pkgVersion string ) string {
@@ -186,6 +192,10 @@ func GetDockerRepoConfig(serverDetails *config.ServerDetails, imageName, depsRep
186192
187193type dockerManifestList struct {
188194 Manifests []struct {
189- Digest string `json:"digest"`
195+ Digest string `json:"digest"`
196+ Platform struct {
197+ Architecture string `json:"architecture"`
198+ OS string `json:"os"`
199+ } `json:"platform"`
190200 } `json:"manifests"`
191201}
0 commit comments