diff --git a/test/new-e2e/tests/installer/script/all_scripts_test.go b/test/new-e2e/tests/installer/script/all_scripts_test.go index ba6d1a64446d..c8638cd63cef 100644 --- a/test/new-e2e/tests/installer/script/all_scripts_test.go +++ b/test/new-e2e/tests/installer/script/all_scripts_test.go @@ -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, diff --git a/test/new-e2e/tests/installer/unix/all_packages_test.go b/test/new-e2e/tests/installer/unix/all_packages_test.go index cade8e21f761..a79b044b637c 100644 --- a/test/new-e2e/tests/installer/unix/all_packages_test.go +++ b/test/new-e2e/tests/installer/unix/all_packages_test.go @@ -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") diff --git a/test/new-e2e/tests/installer/unix/package_apm_inject_test.go b/test/new-e2e/tests/installer/unix/package_apm_inject_test.go index 20f6a227891b..934db34094af 100644 --- a/test/new-e2e/tests/installer/unix/package_apm_inject_test.go +++ b/test/new-e2e/tests/installer/unix/package_apm_inject_test.go @@ -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") } @@ -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") } diff --git a/test/new-e2e/tests/installer/unix/package_ddot_test.go b/test/new-e2e/tests/installer/unix/package_ddot_test.go index 58caea79aa8f..d50585863e12 100644 --- a/test/new-e2e/tests/installer/unix/package_ddot_test.go +++ b/test/new-e2e/tests/installer/unix/package_ddot_test.go @@ -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 } diff --git a/test/new-e2e/tests/installer/unix/package_definitions.go b/test/new-e2e/tests/installer/unix/package_definitions.go index 3b8d3bfdfe81..7f2cfd058415 100644 --- a/test/new-e2e/tests/installer/unix/package_definitions.go +++ b/test/new-e2e/tests/installer/unix/package_definitions.go @@ -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)