@@ -1143,7 +1143,7 @@ func packageAgent(ctx context.Context, platforms []string, dependenciesVersion s
11431143 }
11441144
11451145 // download/copy all the necessary dependencies for packaging elastic-agent
1146- archivePath , dropPath := collectPackageDependencies (platforms , dependenciesVersion , packageTypes , dependencies )
1146+ archivePath , dropPath , dependencies := collectPackageDependencies (platforms , dependenciesVersion , packageTypes , dependencies )
11471147
11481148 // cleanup after build
11491149 defer os .RemoveAll (archivePath )
@@ -1180,7 +1180,7 @@ func packageAgent(ctx context.Context, platforms []string, dependenciesVersion s
11801180// NOTE: after the build is done the caller must:
11811181// - delete archivePath and dropPath contents
11821182// - unset AGENT_DROP_PATH environment variable
1183- func collectPackageDependencies (platforms []string , packageVersion string , packageTypes []devtools.PackageType , dependencies []packaging.BinarySpec ) (archivePath , dropPath string ) {
1183+ func collectPackageDependencies (platforms []string , packageVersion string , packageTypes []devtools.PackageType , dependencies []packaging.BinarySpec ) (archivePath , dropPath string , d []packaging. BinarySpec ) {
11841184 dropPath , found := os .LookupEnv (agentDropPath )
11851185
11861186 // try not to shadow too many variables
@@ -1259,6 +1259,12 @@ func collectPackageDependencies(platforms []string, packageVersion string, packa
12591259 }
12601260 } else {
12611261 packedBeats := []string {"agentbeat" }
1262+ // restrict the dependency list only to agentbeat in this case
1263+ dependencies = packaging .FilterComponents (dependencies , packaging .WithBinaryName ("agentbeat" ))
1264+ if mg .Verbose () {
1265+ log .Printf ("Packaging using a beats repository, reducing dependendencies to %v" , dependencies )
1266+ }
1267+
12621268 // build from local repo, will assume beats repo is located on the same root level
12631269 for _ , b := range packedBeats {
12641270 pwd , err := filepath .Abs (filepath .Join ("../beats/x-pack" , b ))
@@ -1326,7 +1332,7 @@ func collectPackageDependencies(platforms []string, packageVersion string, packa
13261332 } else {
13271333 archivePath = movePackagesToArchive (dropPath , platforms , packageVersion , dependencies )
13281334 }
1329- return archivePath , dropPath
1335+ return archivePath , dropPath , dependencies
13301336}
13311337
13321338func removePythonWheels (matches []string , version string , dependencies []packaging.BinarySpec ) []string {
@@ -1436,7 +1442,11 @@ type branchInfo struct {
14361442// place them under build/dra/buildID. It accepts one argument that has to be a release branch present in staging DRA
14371443func FetchLatestAgentCoreStagingDRA (ctx context.Context , branch string ) error {
14381444
1439- elasticAgentCoreComponents := packaging .FilterComponents (packaging .WithProjectName (agentCoreProjectName ), packaging .WithFIPS (devtools .FIPSBuild ))
1445+ components , err := packaging .Components ()
1446+ if err != nil {
1447+ return fmt .Errorf ("retrieving defined components: %w" , err )
1448+ }
1449+ elasticAgentCoreComponents := packaging .FilterComponents (components , packaging .WithProjectName (agentCoreProjectName ), packaging .WithFIPS (devtools .FIPSBuild ))
14401450
14411451 if len (elasticAgentCoreComponents ) != 1 {
14421452 return fmt .Errorf (
@@ -1679,8 +1689,11 @@ func downloadDRAArtifacts(ctx context.Context, build *manifest.Build, version st
16791689}
16801690
16811691func useDRAAgentBinaryForPackage (ctx context.Context , manifestURL string , version string ) error {
1682-
1683- elasticAgentCoreComponents := packaging .FilterComponents (packaging .WithProjectName (agentCoreProjectName ), packaging .WithFIPS (devtools .FIPSBuild ))
1692+ components , err := packaging .Components ()
1693+ if err != nil {
1694+ return fmt .Errorf ("retrieving defined components: %w" , err )
1695+ }
1696+ elasticAgentCoreComponents := packaging .FilterComponents (components , packaging .WithProjectName (agentCoreProjectName ), packaging .WithFIPS (devtools .FIPSBuild ))
16841697
16851698 if len (elasticAgentCoreComponents ) != 1 {
16861699 return fmt .Errorf (
0 commit comments