Cleanup vagrant setup (#60697)
Though bats tests were recently removed, there remains a few unnecessary setups needed for those tests in our vagrant files, as well as CI setup. Additionally, we no longer rely on the vagrant images setting a JAVA_HOME, instead relying on DistroTestPlugin to pull the appropriate jdk when testing with no-jdk distributions.
This commit is contained in:
parent
fc38af363e
commit
479f32906d
16
.ci/os.sh
16
.ci/os.sh
|
@ -31,12 +31,6 @@ cp -v .ci/init.gradle $HOME/.gradle/init.d
|
|||
|
||||
unset JAVA_HOME
|
||||
|
||||
if ! [ -e "/usr/bin/bats" ] ; then
|
||||
git clone https://github.com/sstephenson/bats /tmp/bats
|
||||
sudo /tmp/bats/install.sh /usr
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "/etc/os-release" ] ; then
|
||||
cat /etc/os-release
|
||||
. /etc/os-release
|
||||
|
@ -54,16 +48,8 @@ else
|
|||
fi
|
||||
|
||||
sudo bash -c 'cat > /etc/sudoers.d/elasticsearch_vars' << SUDOERS_VARS
|
||||
Defaults env_keep += "ZIP"
|
||||
Defaults env_keep += "TAR"
|
||||
Defaults env_keep += "RPM"
|
||||
Defaults env_keep += "DEB"
|
||||
Defaults env_keep += "PACKAGING_ARCHIVES"
|
||||
Defaults env_keep += "PACKAGING_TESTS"
|
||||
Defaults env_keep += "BATS_UTILS"
|
||||
Defaults env_keep += "BATS_TESTS"
|
||||
Defaults env_keep += "SYSTEM_JAVA_HOME"
|
||||
Defaults env_keep += "JAVA_HOME"
|
||||
Defaults env_keep += "SYSTEM_JAVA_HOME"
|
||||
SUDOERS_VARS
|
||||
sudo chmod 0440 /etc/sudoers.d/elasticsearch_vars
|
||||
|
||||
|
|
|
@ -468,39 +468,13 @@ def sh_install_deps(config,
|
|||
|
||||
#{extra}
|
||||
|
||||
installed java || {
|
||||
echo "==> Java is not installed"
|
||||
return 1
|
||||
}
|
||||
cat \<\<JAVA > /etc/profile.d/java_home.sh
|
||||
if [ -z "\\\$JAVA_HOME" ]; then
|
||||
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
|
||||
fi
|
||||
export SYSTEM_JAVA_HOME=\\\$JAVA_HOME
|
||||
unset JAVA_HOME
|
||||
JAVA
|
||||
ensure tar
|
||||
ensure curl
|
||||
ensure unzip
|
||||
ensure rsync
|
||||
ensure expect
|
||||
|
||||
installed bats || {
|
||||
# Bats lives in a git repository....
|
||||
ensure git
|
||||
echo "==> Installing bats"
|
||||
git clone https://github.com/sstephenson/bats /tmp/bats
|
||||
# Centos doesn't add /usr/local/bin to the path....
|
||||
/tmp/bats/install.sh /usr
|
||||
rm -rf /tmp/bats
|
||||
}
|
||||
|
||||
cat \<\<SUDOERS_VARS > /etc/sudoers.d/elasticsearch_vars
|
||||
Defaults env_keep += "BATS_UTILS"
|
||||
Defaults env_keep += "BATS_TESTS"
|
||||
Defaults env_keep += "BATS_PLUGINS"
|
||||
Defaults env_keep += "BATS_UPGRADE"
|
||||
Defaults env_keep += "PACKAGE_NAME"
|
||||
Defaults env_keep += "JAVA_HOME"
|
||||
Defaults env_keep += "SYSTEM_JAVA_HOME"
|
||||
SUDOERS_VARS
|
||||
|
@ -509,23 +483,9 @@ SUDOERS_VARS
|
|||
end
|
||||
|
||||
def windows_common(config, name)
|
||||
config.vm.provision 'markerfile', type: 'shell', inline: <<-SHELL
|
||||
$ErrorActionPreference = "Stop"
|
||||
New-Item C:/is_vagrant_vm -ItemType file -Force | Out-Null
|
||||
SHELL
|
||||
|
||||
config.vm.provision 'set prompt', type: 'shell', inline: <<-SHELL
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ps_prompt = 'function Prompt { "#{name}:$($ExecutionContext.SessionState.Path.CurrentLocation)>" }'
|
||||
$ps_prompt | Out-File $PsHome/Microsoft.PowerShell_profile.ps1
|
||||
SHELL
|
||||
|
||||
config.vm.provision 'set env variables', type: 'shell', inline: <<-SHELL
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Environment]::SetEnvironmentVariable("PACKAGING_ARCHIVES", "C:/project/build/packaging/archives", "Machine")
|
||||
$javaHome = [Environment]::GetEnvironmentVariable("JAVA_HOME", "Machine")
|
||||
[Environment]::SetEnvironmentVariable("SYSTEM_JAVA_HOME", $javaHome, "Machine")
|
||||
[Environment]::SetEnvironmentVariable("PACKAGING_TESTS", "C:/project/build/packaging/tests", "Machine")
|
||||
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine")
|
||||
SHELL
|
||||
end
|
||||
|
|
|
@ -265,6 +265,7 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
VagrantExtension vagrant = project.getExtensions().getByType(VagrantExtension.class);
|
||||
vagrant.setBox(box);
|
||||
vagrant.vmEnv("SYSTEM_JAVA_HOME", convertPath(project, vagrant, systemJdk, "", ""));
|
||||
vagrant.vmEnv("JAVA_HOME", ""); // make sure any default java on the system is ignored
|
||||
vagrant.vmEnv("PATH", convertPath(project, vagrant, gradleJdk, "/bin:$PATH", "\\bin;$Env:PATH"));
|
||||
// pass these along to get correct build scans
|
||||
if (System.getenv("JENKINS_URL") != null) {
|
||||
|
|
Loading…
Reference in New Issue