-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Make All OS tests run on GCP instances #46924
Changes from all commits
22001a2
acaa54d
022b111
ef1d505
d32f68e
911e0c6
9dc9b47
c3f353d
f800c73
45a41dc
052cef7
a5eb27e
5d1afba
33f9a92
3251641
25e0850
579c4ca
ea366a9
c2190da
8069cc7
91d95d6
145aa89
41d309e
dcdc4eb
1d1ae00
6d10d6c
9521323
c59e923
b5447f7
206ea76
fd4d265
28b7257
a4f581f
057363e
042a89a
2d06337
5154be9
760376e
60def58
4d300d2
7715cd5
b9fe4e2
ba7ee5c
e2f1382
30e631f
b70c929
5ca59c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | ||
{ | ||
# Relaunch as an elevated process: | ||
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs | ||
exit | ||
} | ||
|
||
# CI configures these, uncoment if running manually | ||
# | ||
# $env:ES_BUILD_JAVA="java12" | ||
#$env:ES_RUNTIME_JAVA="java11" | ||
|
||
$ErrorActionPreference="Stop" | ||
$gradleInit = "C:\Users\$env:username\.gradle\init.d\" | ||
echo "Remove $gradleInit" | ||
Remove-Item -Recurse -Force $gradleInit -ErrorAction Ignore | ||
New-Item -ItemType directory -Path $gradleInit | ||
echo "Copy .ci/init.gradle to $gradleInit" | ||
Copy-Item .ci/init.gradle -Destination $gradleInit | ||
|
||
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine") | ||
$env:PATH="C:\Users\jenkins\.java\$env:ES_BUILD_JAVA\bin\;$env:PATH" | ||
$env:JAVA_HOME=$null | ||
$env:SYSTEM_JAVA_HOME="C:\Users\jenkins\.java\$env:ES_RUNTIME_JAVA" | ||
Remove-Item -Recurse -Force \tmp -ErrorAction Ignore | ||
New-Item -ItemType directory -Path \tmp | ||
|
||
$ErrorActionPreference="Continue" | ||
# TODO: remove the task exclusions once dependencies are set correctly and these don't run for Windows or buldiung the deb on windows is fixed | ||
& .\gradlew.bat -g "C:\Users\$env:username\.gradle" --parallel --scan --console=plain destructiveDistroTest ` | ||
-x :distribution:packages:buildOssDeb ` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the task dep causing these to be built? We should never even try building these if they won't be used by the test, which was a major goal of the refactoring work here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, but has to be something relating to the OS tests. Either way I would prefer to look at this in a separate PR. |
||
-x :distribution:packages:buildDeb ` | ||
-x :distribution:packages:buildOssRpm ` | ||
-x :distribution:packages:buildRpm ` | ||
|
||
exit $? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
|
||
# opensuse 15 has a missing dep for systemd | ||
|
||
if which zypper > /dev/null ; then | ||
sudo zypper install -y insserv-compat | ||
fi | ||
|
||
# Required by bats | ||
sudo touch /etc/is_vagrant_vm | ||
sudo useradd vagrant | ||
|
||
set -e | ||
|
||
. .ci/java-versions.properties | ||
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA | ||
BUILD_JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA | ||
|
||
rm -Rfv $HOME/.gradle/init.d/ && mkdir -p $HOME/.gradle/init.d | ||
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 | ||
if [[ "$ID" == "debian" || "$ID_LIKE" == "debian" ]] ; then | ||
# FIXME: The base image should not have rpm installed | ||
sudo rm -Rf /usr/bin/rpm | ||
fi | ||
else | ||
cat /etc/issue || true | ||
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" | ||
SUDOERS_VARS | ||
sudo chmod 0440 /etc/sudoers.d/elasticsearch_vars | ||
|
||
# Bats tests still use this locationa | ||
sudo rm -Rf /elasticsearch | ||
sudo mkdir -p /elasticsearch/qa/ && sudo chown jenkins /elasticsearch/qa/ && ln -s $PWD/qa/vagrant /elasticsearch/qa/ | ||
|
||
# sudo sets it's own PATH thus we use env to override that and call sudo annother time so we keep the secure root PATH | ||
# run with --continue to run both bats and java tests even if one fails | ||
# be explicit about Gradle home dir so we use the same even with sudo | ||
sudo -E env \ | ||
PATH=$BUILD_JAVA_HOME/bin:`sudo bash -c 'echo -n $PATH'` \ | ||
RUNTIME_JAVA_HOME=`readlink -f -n $RUNTIME_JAVA_HOME` \ | ||
--unset=JAVA_HOME \ | ||
SYSTEM_JAVA_HOME=`readlink -f -n $RUNTIME_JAVA_HOME` \ | ||
./gradlew -g $HOME/.gradle --scan --parallel $@ --continue destructivePackagingTest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ buildScan { | |
} else { | ||
tag 'LOCAL' | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just set these if they are not set so manual editing is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planning to read
.ci/java-versions.properties
like in Linux, but in a follow up.