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

Bumped test infra for agent 6 #34356

Merged
merged 10 commits into from
Mar 5, 2025
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ variables:
# and check the job creating the image to make sure you have the right SHA prefix
TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: ""
# Make sure to update test-infra-definitions version in go.mod as well
TEST_INFRA_DEFINITIONS_BUILDIMAGES: eefd2de87300
TEST_INFRA_DEFINITIONS_BUILDIMAGES: fc57c00046a6
DATADOG_AGENT_BUILDERS: v28719426-b6a4fd9

DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/common/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
"github.com/DataDog/datadog-agent/pkg/config"
"github.com/DataDog/datadog-agent/pkg/sbom/scanner"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

// GetWorkloadmetaInit provides the InitHelper for workloadmeta so it can be injected as a Param
Expand All @@ -25,7 +25,7 @@ func GetWorkloadmetaInit() workloadmeta.InitHelper {
return workloadmeta.InitHelper(func(ctx context.Context, wm workloadmeta.Component) error {
// SBOM scanner needs to be called here as initialization is required prior to the
// catalog getting instantiated and initialized.
sbomScanner, err := scanner.CreateGlobalScanner(config.Datadog, optional.NewOption(wm))
sbomScanner, err := scanner.CreateGlobalScanner(config.Datadog, option.New(wm))
if err != nil {
return fmt.Errorf("failed to create SBOM scanner: %s", err)
} else if sbomScanner != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/common/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/DataDog/datadog-agent/cmd/agent/common/path"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/config"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

// SetupConfigForTest fires up the configuration system and returns warnings if any.
Expand All @@ -36,7 +36,7 @@ func SetupConfigForTest(confFilePath string) (*config.Warnings, error) {
}
cfg.AddConfigPath(path.DefaultConfPath)
// load the configuration
warnings, err := config.LoadDatadogCustom(cfg, origin, optional.NewNoneOption[secrets.Component](), nil)
warnings, err := config.LoadDatadogCustom(cfg, origin, option.None[secrets.Component](), nil)
if err != nil {
// special-case permission-denied with a clearer error message
if errors.Is(err, fs.ErrPermission) {
Expand Down
10 changes: 5 additions & 5 deletions cmd/agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/diagnose/diagnosis"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
utillog "github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"

"github.com/cihub/seelog"
"github.com/fatih/color"
Expand Down Expand Up @@ -99,7 +99,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
NoInstance: !cliParams.runLocal,
}
}),
fx.Supply(optional.NewNoneOption[collector.Component]()),
fx.Supply(option.None[collector.Component]()),
workloadmeta.Module(),
tagger.Module(),
fx.Provide(func(config config.Component) tagger.Params { return tagger.NewTaggerParamsForCoreAgent(config) }),
Expand Down Expand Up @@ -234,9 +234,9 @@ This command print the package-signing metadata payload. This payload is used by

func cmdDiagnose(cliParams *cliParams,
senderManager diagnosesendermanager.Component,
wmeta optional.Option[workloadmeta.Component],
wmeta option.Option[workloadmeta.Component],
ac autodiscovery.Component,
collector optional.Option[collector.Component],
collector option.Option[collector.Component],
secretResolver secrets.Component) error {
diagCfg := diagnosis.Config{
Verbose: cliParams.verbose,
Expand All @@ -245,7 +245,7 @@ func cmdDiagnose(cliParams *cliParams,
Exclude: cliParams.exclude,
}

diagnoseDeps := diagnose.NewSuitesDeps(senderManager, collector, secretResolver, wmeta, optional.NewOption(ac))
diagnoseDeps := diagnose.NewSuitesDeps(senderManager, collector, secretResolver, wmeta, option.New(ac))
// Is it List command
if cliParams.listSuites {
diagnose.ListStdOut(color.Output, diagCfg, diagnoseDeps)
Expand Down
8 changes: 4 additions & 4 deletions cmd/agent/subcommands/flare/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/serializer"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/input"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

// cliParams are the command-line arguments for this subcommand
Expand Down Expand Up @@ -116,7 +116,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
tagger.OptionalModule(),
autodiscoveryimpl.OptionalModule(), // if forceLocal is true, we will start autodiscovery (loadComponents) later
flare.Module(),
fx.Supply(optional.NewNoneOption[collector.Component]()),
fx.Supply(option.None[collector.Component]()),
diagnosesendermanagerimpl.Module(),
// We need inventoryagent to fill the status page generated by the flare.
inventoryagentimpl.Module(),
Expand Down Expand Up @@ -239,8 +239,8 @@ func makeFlare(flareComp flare.Component,
config config.Component,
_ sysprobeconfig.Component,
cliParams *cliParams,
_ optional.Option[workloadmeta.Component],
_ optional.Option[tagger.Component]) error {
_ option.Option[workloadmeta.Component],
_ option.Option[tagger.Component]) error {
var (
profile flare.ProfileData
err error
Expand Down
10 changes: 5 additions & 5 deletions cmd/agent/subcommands/jmx/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import (
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
"github.com/DataDog/datadog-agent/pkg/config/model"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

type cliParams struct {
Expand Down Expand Up @@ -147,11 +147,11 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Provide(func() demultiplexer.Component { return nil }),
fx.Provide(func() inventorychecks.Component { return nil }),
fx.Provide(func() packagesigning.Component { return nil }),
fx.Provide(func() optional.Option[rcservice.Component] { return optional.NewNoneOption[rcservice.Component]() }),
fx.Provide(func() optional.Option[rcserviceha.Component] { return optional.NewNoneOption[rcserviceha.Component]() }),
fx.Provide(func() option.Option[rcservice.Component] { return option.None[rcservice.Component]() }),
fx.Provide(func() option.Option[rcserviceha.Component] { return option.None[rcserviceha.Component]() }),
fx.Provide(func() status.Component { return nil }),
fx.Provide(func() eventplatformreceiver.Component { return nil }),
fx.Provide(func() optional.Option[collector.Component] { return optional.NewNoneOption[collector.Component]() }),
fx.Provide(func() option.Option[collector.Component] { return option.None[collector.Component]() }),
fx.Provide(tagger.NewTaggerParamsForCoreAgent),
tagger.Module(),
autodiscoveryimpl.Module(),
Expand Down Expand Up @@ -291,7 +291,7 @@ func runJmxCommandConsole(config config.Component,
diagnoseSendermanager diagnosesendermanager.Component,
secretResolver secrets.Component,
agentAPI internalAPI.Component,
collector optional.Option[collector.Component]) error {
collector option.Option[collector.Component]) error {
// This prevents log-spam from "comp/core/workloadmeta/collectors/internal/remote/process_collector/process_collector.go"
// It appears that this collector creates some contention in AD.
// Disabling it is both more efficient and gets rid of this log spam
Expand Down
14 changes: 7 additions & 7 deletions cmd/agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/util/installinfo"
"github.com/DataDog/datadog-agent/pkg/util/kubernetes/apiserver/leaderelection"
pkglog "github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
"github.com/DataDog/datadog-agent/pkg/version"

// runtime init routines
Expand Down Expand Up @@ -203,7 +203,7 @@ func run(log log.Component,
demultiplexer demultiplexer.Component,
sharedSerializer serializer.MetricSerializer,
cliParams *cliParams,
logsAgent optional.Option[logsAgent.Component],
logsAgent option.Option[logsAgent.Component],
processAgent processAgent.Component,
otelcollector otelcollector.Component,
_ host.Component,
Expand Down Expand Up @@ -347,8 +347,8 @@ func getSharedFxOption() fx.Option {
fx.Provide(tagger.NewTaggerParamsForCoreAgent),
tagger.Module(),
autodiscoveryimpl.Module(),
fx.Provide(func(ac autodiscovery.Component) optional.Option[autodiscovery.Component] {
return optional.NewOption[autodiscovery.Component](ac)
fx.Provide(func(ac autodiscovery.Component) option.Option[autodiscovery.Component] {
return option.New[autodiscovery.Component](ac)
}),

// TODO: (components) - some parts of the agent (such as the logs agent) implicitly depend on the global state
Expand Down Expand Up @@ -409,7 +409,7 @@ func startAgent(
taggerComp tagger.Component,
ac autodiscovery.Component,
rcclient rcclient.Component,
logsAgent optional.Option[logsAgent.Component],
logsAgent option.Option[logsAgent.Component],
_ processAgent.Component,
_ defaultforwarder.Component,
_ serializer.MetricSerializer,
Expand Down Expand Up @@ -559,7 +559,7 @@ func startAgent(
ac,
logsAgent,
demultiplexer,
optional.NewOption(collector),
option.New(collector),
); err != nil {
return log.Errorf("Error while starting api server, exiting: %v", err)
}
Expand Down Expand Up @@ -604,7 +604,7 @@ func startAgent(

// Set up check collector
commonchecks.RegisterChecks(wmeta)
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(option.New(collector), demultiplexer), true)

demultiplexer.AddAgentStartupTelemetry(version.AgentVersion)

Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/subcommands/run/command_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import (
"github.com/DataDog/datadog-agent/comp/remote-config/rcclient"
"github.com/DataDog/datadog-agent/pkg/serializer"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
// runtime init routines
)

Expand Down Expand Up @@ -97,7 +97,7 @@ func StartAgentWithDefaults(ctxChan <-chan context.Context) (<-chan error, error
ac autodiscovery.Component,
rcclient rcclient.Component,
forwarder defaultforwarder.Component,
logsAgent optional.Option[logsAgent.Component],
logsAgent option.Option[logsAgent.Component],
processAgent processAgent.Component,
metadataRunner runner.Component,
sharedSerializer serializer.MetricSerializer,
Expand Down
6 changes: 3 additions & 3 deletions cmd/cluster-agent-cloudfoundry/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/hostname"
pkglog "github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
"github.com/DataDog/datadog-agent/pkg/version"

"go.uber.org/fx"
Expand Down Expand Up @@ -159,12 +159,12 @@ func run(log log.Component,
common.LoadComponents(secretResolver, wmeta, ac, pkgconfig.Datadog.GetString("confd_path"))

// Set up check collector
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(option.New(collector), demultiplexer), true)

// start the autoconfig, this will immediately run any configured check
ac.LoadAndRun(mainCtx)

if err = api.StartServer(wmeta, taggerComp, ac, demultiplexer, optional.NewOption(collector), statusComponent, secretResolver); err != nil {
if err = api.StartServer(wmeta, taggerComp, ac, demultiplexer, option.New(collector), statusComponent, secretResolver); err != nil {
return log.Errorf("Error while starting agent API, exiting: %v", err)
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/cluster-agent/api/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ import (
"github.com/DataDog/datadog-agent/pkg/status/health"
"github.com/DataDog/datadog-agent/pkg/util/hostname"
"github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
"github.com/DataDog/datadog-agent/pkg/version"
)

// SetupHandlers adds the specific handlers for cluster agent endpoints
func SetupHandlers(r *mux.Router, wmeta workloadmeta.Component, ac autodiscovery.Component, senderManager sender.DiagnoseSenderManager, collector optional.Option[collector.Component], statusComponent status.Component, secretResolver secrets.Component) {
func SetupHandlers(r *mux.Router, wmeta workloadmeta.Component, ac autodiscovery.Component, senderManager sender.DiagnoseSenderManager, collector option.Option[collector.Component], statusComponent status.Component, secretResolver secrets.Component) {
r.HandleFunc("/version", getVersion).Methods("GET")
r.HandleFunc("/hostname", getHostname).Methods("GET")
r.HandleFunc("/flare", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -133,7 +133,7 @@ func getHostname(w http.ResponseWriter, r *http.Request) {
w.Write(j)
}

func makeFlare(w http.ResponseWriter, r *http.Request, senderManager sender.DiagnoseSenderManager, collector optional.Option[collector.Component], secretResolver secrets.Component, wmeta workloadmeta.Component, statusComponent status.Component, ac autodiscovery.Component) {
func makeFlare(w http.ResponseWriter, r *http.Request, senderManager sender.DiagnoseSenderManager, collector option.Option[collector.Component], secretResolver secrets.Component, wmeta workloadmeta.Component, statusComponent status.Component, ac autodiscovery.Component) {
log.Infof("Making a flare")
w.Header().Set("Content-Type", "application/json")

Expand All @@ -156,7 +156,7 @@ func makeFlare(w http.ResponseWriter, r *http.Request, senderManager sender.Diag
if logFile == "" {
logFile = path.DefaultDCALogFile
}
diagnoseDeps := diagnose.NewSuitesDeps(senderManager, collector, secretResolver, optional.NewOption(wmeta), optional.NewOption[autodiscovery.Component](ac))
diagnoseDeps := diagnose.NewSuitesDeps(senderManager, collector, secretResolver, option.New(wmeta), option.New[autodiscovery.Component](ac))
filePath, err := flare.CreateDCAArchive(false, path.GetDistPath(), logFile, profile, diagnoseDeps, statusComponent)
if err != nil || filePath == "" {
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster-agent/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/config"
pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core"
grpcutil "github.com/DataDog/datadog-agent/pkg/util/grpc"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

var (
Expand All @@ -54,7 +54,7 @@ var (
)

// StartServer creates the router and starts the HTTP server
func StartServer(w workloadmeta.Component, taggerComp tagger.Component, ac autodiscovery.Component, senderManager sender.DiagnoseSenderManager, collector optional.Option[collector.Component], statusComponent status.Component, secretResolver secrets.Component) error {
func StartServer(w workloadmeta.Component, taggerComp tagger.Component, ac autodiscovery.Component, senderManager sender.DiagnoseSenderManager, collector option.Option[collector.Component], statusComponent status.Component, secretResolver secrets.Component) error {
// create the root HTTP router
router = mux.NewRouter()
apiRouter = router.PathPrefix("/api/v1").Subrouter()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster-agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/diagnose"
"github.com/DataDog/datadog-agent/pkg/diagnose/diagnosis"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
)

// Commands returns a slice of subcommands for the 'cluster-agent' command.
Expand Down Expand Up @@ -64,7 +64,7 @@ func run(diagnoseSenderManager diagnosesendermanager.Component, secretResolver s
RunLocal: true, // do not attept to run in actual runnin agent (may need to implement it in future)
Include: []string{"connectivity-datadog-autodiscovery"},
}
diagnoseDeps := diagnose.NewSuitesDeps(diagnoseSenderManager, optional.NewNoneOption[collector.Component](), secretResolver, optional.NewNoneOption[workloadmeta.Component](), optional.NewNoneOption[autodiscovery.Component]())
diagnoseDeps := diagnose.NewSuitesDeps(diagnoseSenderManager, option.None[collector.Component](), secretResolver, option.None[workloadmeta.Component](), option.None[autodiscovery.Component]())

return diagnose.RunStdOut(color.Output, diagCfg, diagnoseDeps)
}
8 changes: 4 additions & 4 deletions cmd/cluster-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/DataDog/datadog-agent/pkg/remoteconfig/state"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"

"github.com/DataDog/datadog-agent/cmd/agent/common"
"github.com/DataDog/datadog-agent/cmd/agent/common/path"
Expand Down Expand Up @@ -184,7 +184,7 @@ func start(log log.Component,
secretResolver secrets.Component,
statusComponent status.Component,
collector collector.Component,
rcService optional.Option[rccomp.Component]) error {
rcService option.Option[rccomp.Component]) error {
stopCh := make(chan struct{})

mainCtx, mainCtxCancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -263,7 +263,7 @@ func start(log log.Component,
}

// Starting server early to ease investigations
if err := api.StartServer(wmeta, taggerComp, ac, demultiplexer, optional.NewOption(collector), statusComponent, secretResolver); err != nil {
if err := api.StartServer(wmeta, taggerComp, ac, demultiplexer, option.New(collector), statusComponent, secretResolver); err != nil {
return fmt.Errorf("Error while starting agent API, exiting: %v", err)
}

Expand Down Expand Up @@ -344,7 +344,7 @@ func start(log log.Component,

// Set up check collector
registerChecks()
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)
ac.AddScheduler("check", pkgcollector.InitCheckScheduler(option.New(collector), demultiplexer), true)

// start the autoconfig, this will immediately run any configured check
ac.LoadAndRun(mainCtx)
Expand Down
6 changes: 3 additions & 3 deletions cmd/dogstatsd/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/util"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
pkglog "github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"
"github.com/DataDog/datadog-agent/pkg/version"
)

Expand Down Expand Up @@ -177,8 +177,8 @@ func start(
params *Params,
server dogstatsdServer.Component,
_ defaultforwarder.Component,
wmeta optional.Option[workloadmeta.Component],
_ optional.Option[tagger.Component],
wmeta option.Option[workloadmeta.Component],
_ option.Option[tagger.Component],
demultiplexer demultiplexer.Component,
_ runner.Component,
_ resources.Component,
Expand Down
4 changes: 2 additions & 2 deletions cmd/otel-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/serializer"
"github.com/DataDog/datadog-agent/pkg/telemetry"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/optional"
"github.com/DataDog/datadog-agent/pkg/util/option"

"go.uber.org/fx"
)
Expand All @@ -50,7 +50,7 @@ var cfgPath = flag.String("config", "/opt/datadog-agent/etc/datadog.yaml", "agen
func run(
c collector.Component,
demux *aggregator.AgentDemultiplexer,
logsAgent optional.Option[logsAgent.Component], //nolint:revive // TODO fix unused-parameter
logsAgent option.Option[logsAgent.Component], //nolint:revive // TODO fix unused-parameter
) error {
// Setup stats telemetry handler
if sender, err := demux.GetDefaultSender(); err == nil {
Expand Down
Loading
Loading