Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions test/new-e2e/tests/installer/script/all_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,8 @@ type installerScriptSuite interface {
}

func newInstallerScriptSuite(pkg string, e2eos e2eos.Descriptor, arch e2eos.Architecture, opts ...awshost.ProvisionerOption) installerScriptBaseSuite {
var scriptURLPrefix string
if pipelineID, ok := os.LookupEnv("E2E_PIPELINE_ID"); ok {
scriptURLPrefix = fmt.Sprintf("https://s3.amazonaws.com/installtesting.datad0g.com/pipeline-%s/scripts/", pipelineID)
} else if commitHash, ok := os.LookupEnv("CI_COMMIT_SHA"); ok {
scriptURLPrefix = fmt.Sprintf("https://s3.amazonaws.com/installtesting.datad0g.com/%s/scripts/", commitHash)
} else {
require.FailNowf(nil, "missing script identifier", "CI_COMMIT_SHA or CI_PIPELINE_ID must be set")
}

return installerScriptBaseSuite{
scriptURLPrefix: scriptURLPrefix,
scriptURLPrefix: "https://" + installer.InstallerScriptBaseURL() + "/scripts/",
os: e2eos,
arch: arch,
pkg: pkg,
Expand Down
9 changes: 7 additions & 2 deletions test/new-e2e/tests/installer/unix/all_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,17 @@ func (s *packageBaseSuite) RunInstallScript(params ...string) {
time.Sleep(time.Second)
}

// Write the playbook
// Write the playbook. InstallScriptEnv sets datadog_installer_registry to the
// pipeline OCI registry (installtesting.datad0g.com.internal.dda-testing.com), which
// the role passes as DD_INSTALLER_REGISTRY_URL_INSTALLER_PACKAGE to install-ssi.sh.
// The script URL is overridden via -e (extra vars beat set_fact) so ansible fetches
// the pipeline-specific install-ssi.sh from S3 instead of the production script.
env := InstallScriptEnv(s.arch)
playbookPath := s.writeAnsiblePlaybook(env, params...)
scriptURL := "https://" + InstallerScriptBaseURL() + "/scripts/install-ssi.sh"

// Run the playbook
s.Env().RemoteHost.MustExecute(fmt.Sprintf("%sansible-playbook -vvv %s", ansiblePrefix, playbookPath))
s.Env().RemoteHost.MustExecute(fmt.Sprintf("%sansible-playbook -vvv %s -e 'datadog_installer_install_ssi_script_url=%s'", ansiblePrefix, playbookPath, scriptURL))

// touch install files for compatibility
s.Env().RemoteHost.MustExecute("touch /tmp/datadog-installer-stdout.log")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,6 @@ func (s *packageApmInjectSuite) assertAppArmorProfile() {
// install; direct instrumentation covers the current boot. The service's ExecStart/ExecStop
// commands (instrument-start/instrument-stop) manage /etc/ld.so.preload on every reboot.
func (s *packageApmInjectSuite) TestSystemdService() {
if s.installMethod == InstallMethodAnsible {
s.T().Skip("Ansible runs stable install-ssi script")
}
if _, err := s.Env().RemoteHost.Execute("test \"$(cat /proc/1/comm 2>/dev/null)\" = systemd"); err != nil {
s.T().Skip("systemd is not running as PID 1 on this host")
}
Expand Down Expand Up @@ -596,9 +593,6 @@ func (s *packageApmInjectSuite) TestSystemdService() {
// /etc/ld.so.preload when systemd is not the init system, without creating a service file.
// This test only runs on hosts where systemd is not PID 1; TestSystemdService covers the systemd path.
func (s *packageApmInjectSuite) TestInstrumentHost_NoSystemd() {
if s.installMethod == InstallMethodAnsible {
s.T().Skip("Ansible runs stable install-ssi script")
}
if _, err := s.Env().RemoteHost.Execute("test \"$(cat /proc/1/comm 2>/dev/null)\" = systemd"); err == nil {
s.T().Skip("systemd is PID 1 on this host; TestSystemdService covers that path")
}
Expand Down
9 changes: 1 addition & 8 deletions test/new-e2e/tests/installer/unix/package_ddot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,7 @@ func (s *packageDDOTSuite) RunInstallScriptWithError(params ...string) error {
}
if hasOTelCollector {
// This is temporary until the install script is updated to support calling the installer script
var scriptURLPrefix string
if pipelineID, ok := os.LookupEnv("E2E_PIPELINE_ID"); ok {
scriptURLPrefix = fmt.Sprintf("https://s3.amazonaws.com/installtesting.datad0g.com/pipeline-%s/scripts/", pipelineID)
} else if commitHash, ok := os.LookupEnv("CI_COMMIT_SHA"); ok {
scriptURLPrefix = fmt.Sprintf("https://s3.amazonaws.com/installtesting.datad0g.com/%s/scripts/", commitHash)
} else {
require.FailNowf(nil, "missing script identifier", "CI_COMMIT_SHA or CI_PIPELINE_ID must be set")
}
scriptURLPrefix := "https://" + InstallerScriptBaseURL() + "/scripts/"
_, err := s.Env().RemoteHost.Execute(fmt.Sprintf(`%s bash -c "$(curl -L %sinstall.sh)" > /tmp/datadog-installer-stdout.log 2> /tmp/datadog-installer-stderr.log`, strings.Join(params, " "), scriptURLPrefix), client.WithEnvVariables(InstallInstallerScriptEnvWithPackages()))
return err
}
Expand Down
15 changes: 15 additions & 0 deletions test/new-e2e/tests/installer/unix/package_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ func installScriptInstallerEnv(env map[string]string, packagesConfig []TestPacka
}
}

// InstallerScriptBaseURL returns the host+path prefix (no scheme, no trailing suffix) where
// pipeline-specific install scripts are hosted. Pipeline builds write scripts to
// s3://installtesting.datad0g.com/pipeline-{CI_PIPELINE_ID}/scripts/, commit builds to
// s3://installtesting.datad0g.com/{CI_COMMIT_SHA}/scripts/. Falls back to production when
// neither variable is set.
func InstallerScriptBaseURL() string {
if pipelineID, ok := os.LookupEnv("E2E_PIPELINE_ID"); ok {
return "s3.amazonaws.com/installtesting.datad0g.com/pipeline-" + pipelineID
}
if commitHash, ok := os.LookupEnv("CI_COMMIT_SHA"); ok {
return "s3.amazonaws.com/installtesting.datad0g.com/" + commitHash
}
return "install.datadoghq.com"
}

// InstallScriptEnv returns the environment variables for the install script
func InstallScriptEnv(arch e2eos.Architecture) map[string]string {
return InstallScriptEnvWithPackages(arch, PackagesConfig)
Expand Down
Loading