agent

package
v0.52.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package agent includes helpers related to the Datadog Agent on Windows

Package agent includes helpers related to the Datadog Agent on Windows

Index

Constants

View Source
const (
	// DatadogCodeSignatureThumbprint is the thumbprint of the Datadog Code Signing certificate
	// Valid From: May 2023
	// Valid To:   May 2025
	DatadogCodeSignatureThumbprint = `B03F29CC07566505A718583E9270A6EE17678742`
)

Variables

This section is empty.

Functions

func GetBetaMSIURL added in v0.52.0

func GetBetaMSIURL(version string, arch string) (string, error)

GetBetaMSIURL returns the URL for the beta agent MSI majorVersion: 6, 7 arch: x86_64

func GetChannelURL added in v0.52.0

func GetChannelURL(channel string) (string, error)

GetChannelURL returns the URL for the channel name channel: beta, stable

func GetDatadogAgentProductCode

func GetDatadogAgentProductCode(host *components.RemoteHost) (string, error)

GetDatadogAgentProductCode returns the product code GUID for the Datadog Agent

func GetLatestMSIURL added in v0.52.0

func GetLatestMSIURL(majorVersion string, arch string) string

GetLatestMSIURL returns the URL for the latest agent MSI majorVersion: 6, 7 arch: x86_64

func GetMSIURL added in v0.52.0

func GetMSIURL(channel string, version string, arch string) (string, error)

GetMSIURL returns the URL for the agent MSI channel: beta, stable majorVersion: 6, 7 arch: x86_64

func GetPipelineMSIURL added in v0.52.0

func GetPipelineMSIURL(pipelineID string, majorVersion string, arch string) (string, error)

GetPipelineMSIURL returns the URL for the agent MSI built by the pipeline majorVersion: 6, 7 arch: x86_64

func GetStableMSIURL added in v0.52.0

func GetStableMSIURL(version string, arch string) (string, error)

GetStableMSIURL returns the URL for the stable agent MSI majorVersion: 6, 7 arch: x86_64

func HasValidDatadogCodeSignature added in v0.52.0

func HasValidDatadogCodeSignature(host *components.RemoteHost, path string) error

HasValidDatadogCodeSignature an error if the file at the given path is not validy signed by the Datadog Code Signing certificate

func LookupArchFromEnv added in v0.52.0

func LookupArchFromEnv() (string, bool)

LookupArchFromEnv looks at environment variabes to select the agent arch, if the value is found it is returned along with true, otherwise a default value and false are returned.

WINDOWS_AGENT_ARCH: The arch of the agent, x86_64

Default arch: x86_64

func LookupChannelFromEnv added in v0.52.0

func LookupChannelFromEnv() (string, bool)

LookupChannelFromEnv looks at environment variabes to select the agent channel, if the value is found it is returned along with true, otherwise a default value and false are returned.

WINDOWS_AGENT_CHANNEL: beta, stable

Default channel: stable

func LookupChannelURLFromEnv added in v0.52.0

func LookupChannelURLFromEnv() (string, bool)

LookupChannelURLFromEnv looks at environment variabes to select the agent channel URL, if the value is found it is returned along with true, otherwise a default value and false are returned.

WINDOWS_AGENT_CHANNEL_URL: URL to installers_v2.json

See also LookupChannelFromEnv()

Default channel: stable

func LookupVersionFromEnv added in v0.52.0

func LookupVersionFromEnv() (string, bool)

LookupVersionFromEnv looks at environment variabes to select the agent version, if the value is found it is returned along with true, otherwise a default value and false are returned.

In order of priority:

WINDOWS_AGENT_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7

AGENT_MAJOR_VERSION: The major version of the agent, 6 or 7

If only a major version is provided, the latest version of that major version is used.

Default version: 7

func RepairAllAgent added in v0.52.0

func RepairAllAgent(host *components.RemoteHost, args string, logPath string) error

RepairAllAgent repairs the Datadog Agent

func TestAgentVersion added in v0.52.0

func TestAgentVersion(t *testing.T, expected string, actual string) bool

TestAgentVersion compares the major.minor.patch-prefix parts of two agent versions

func TestValidDatadogCodeSignatures added in v0.52.0

func TestValidDatadogCodeSignatures(t *testing.T, host *components.RemoteHost, paths []string) bool

TestValidDatadogCodeSignatures verifies that the files at the given paths are validly signed by the Datadog Code Signing certificate This test is skipped if the verify_code_signature parameter is set to false.

func UninstallAgent

func UninstallAgent(host *components.RemoteHost, logPath string) error

UninstallAgent uninstalls the Datadog Agent

Types

type Package added in v0.52.0

type Package struct {
	// PipelineID is the pipeline ID used to lookup the MSI URL from the CI pipeline artifacts.
	PipelineID string
	// Channel is the channel used to lookup the MSI URL for the Version from the installers_v2.json file.
	Channel string
	// Version is the version of the MSI, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7
	Version string
	// Arch is the architecture of the MSI, e.g. x86_64
	Arch string
	// URL is the URL the MSI can be downloaded from
	URL string
}

Package contains identifying information about an Agent MSI package.

func GetLastStablePackageFromEnv added in v0.52.0

func GetLastStablePackageFromEnv() (*Package, error)

GetLastStablePackageFromEnv returns the latest stable agent MSI URL.

These environment variables are mutually exclusive, only one should be set, listed here in the order they are considered:

LAST_STABLE_WINDOWS_AGENT_MSI_URL: manually provided URL (all other parameters are informational only)

LAST_STABLE_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7, arch and channel are used

The value of LAST_STABLE_VERSION is set in release.json, and can be acquired by running: invoke release.get-release-json-value "last_stable::$AGENT_MAJOR_VERSION"

func GetPackageFromEnv added in v0.52.0

func GetPackageFromEnv() (*Package, error)

GetPackageFromEnv looks at environment variabes to select the Agent MSI URL.

The returned Package contains the MSI URL and other identifying information. Some Package fields will be populated but may not be related to the returned URL. For example, if a URL is provided directly, the Channel, Version, and Arch fields have no effect on the returned URL. They are returned anyway so they can be used for other purposes, such as logging, stack name, instance options, test assertions, etc.

These environment variables are mutually exclusive, only one should be set, listed here in the order they are considered:

WINDOWS_AGENT_MSI_URL: manually provided URL (all other parameters are informational only)

CI_PIPELINE_ID: use the URL from a specific CI pipeline, major version and arch are used, channel is blank

WINDOWS_AGENT_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7, arch and channel are used

Other environment variables:

WINDOWS_AGENT_CHANNEL: beta or stable

WINDOWS_AGENT_ARCH: The arch of the agent, x86_64

If a channel is not provided and the version contains `-rc.`, the beta channel is used.

See other Lookup*FromEnv functions for more options and details.

If none of the above are set, the latest stable version is used.

func (*Package) AgentVersion added in v0.52.0

func (p *Package) AgentVersion() string

AgentVersion returns a string containing version number and the pre only, e.g. `0.0.0-beta.1`

Directories

Path Synopsis
installers
v2
Package installers processes the installers_v2.json file
Package installers processes the installers_v2.json file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL