如何在AppVeyor构建代理上可靠地安装和运行Elasticsearch?

时间:2018-06-08 19:19:29

标签: elasticsearch chocolatey appveyor

我有一个带有集成测试的.NET项目,需要本地运行的Elasticsearch实例。我试图让这些在AppVeyor上运行。以下是我appveyor.yml的相关位:

install:
  - cinst elasticsearch
  - elasticsearch-service-x64 start

第一个命令,通过Chocolatey安装Elasticsearch,可以游泳。第二个启动服务,大约一半时间成功,我对Elasticsearch实例的所有测试都通过了。然而,另一半,使用此消息在该行之后立即失败:

Command exited with code 5

关于如何让它可靠地工作的任何想法?

为了完整性,这里是失败构建的输出:

cinst elasticsearch
Chocolatey v0.10.8
Installing the following packages:
elasticsearch
By installing you accept licenses for the packages.
Progress: Downloading server-jre8 8.0.172... 100%
Progress: Downloading elasticsearch 6.2.4... 100%
server-jre8 v8.0.172 [Approved]
server-jre8 package files install completed. Performing other installation steps.
Hashes match.
Extracting C:\Users\appveyor\AppData\Local\Temp\chocolatey\server-jre8\8.0.172\server-jre-8u172-windows-x64.tar.gz to C:\Users\appveyor\AppData\Local\Temp\chocolatey\server-jre8\8.0.172...
C:\Users\appveyor\AppData\Local\Temp\chocolatey\server-jre8\8.0.172
Extracting C:\Users\appveyor\AppData\Local\Temp\chocolatey\server-jre8\8.0.172\server-jre-8u172-windows-x64.tar to C:\tools\Java\server-jre...
C:\tools\Java\server-jre
PATH environment variable does not have %JAVA_HOME%\bin in it. Adding...
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;C:\Tools\GitVersion;C:\Tools\NuGet;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\PsTools;C:\Program Files\Git LFS;C:\Program Files\Mercurial\;C:\Program Files (x86)\Subversion\bin;C:\Tools\WebDriver;C:\Tools\Coverity\bin;C:\Tools\MSpec;C:\Tools\NUnit\bin;C:\Tools\NUnit3;C:\Tools\xUnit;C:\Program Files\nodejs;C:\Program Files (x86)\iojs;C:\Program Files\iojs;C:\Users\appveyor\AppData\Roaming\npm;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Ruby193\bin;C:\go\bin;C:\Program Files\Java\jdk1.8.0\bin;C:\Program Files (x86)\Apache\Maven\bin;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\CMake\bin;C:\Tools\curl\bin;C:\Users\appveyor\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130;C:\Program Files\Amazon\AWSCLI\;C:\Program Files\dotnet\;C:\Tools\vcpkg;C:\Program Files (x86)\dotnet\;C:\Users\appveyor\AppData\Local\Microsoft\WindowsApps;C:\Users\appveyor\AppData\Local\Yarn\bin;C:\Users\appveyor\AppData\Roaming\npm;C:\Program Files\Docker;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\TestPlatform;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\erl9.2\bin;C:\Program Files (x86)\NSIS;C:\Program Files (x86)\Yarn\bin\;C:\Tools\Octopus;C:\Program Files\PowerShell\6.0.2;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\LLVM\bin;C:\Program Files (x86)\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\ProgramData\chocolatey\bin;%JAVA_HOME%\bin;
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of server-jre8 was successful.
  Software installed to 'C:\tools\Java\server-jre'
elasticsearch v6.2.4 [Approved]
elasticsearch package files install completed. Performing other installation steps.
Downloading elasticsearch 
  from 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.zip'
Progress: 100% - Completed download of C:\Users\appveyor\AppData\Local\Temp\1\chocolatey\elasticsearch\6.2.4\elasticsearch-6.2.4.zip (27.75 MB).
Download of elasticsearch-6.2.4.zip (27.75 MB) completed.
Extracting C:\Users\appveyor\AppData\Local\Temp\1\chocolatey\elasticsearch\6.2.4\elasticsearch-6.2.4.zip to C:\ProgramData\chocolatey\lib\elasticsearch\tools...
C:\ProgramData\chocolatey\lib\elasticsearch\tools
PATH environment variable does not have C:\ProgramData\chocolatey\lib\elasticsearch\tools\elasticsearch-6.2.4\bin in it. Adding...
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "C:\Progra~1\Java\jdk1.8.0"
-Xms1g;-Xmx1g;-XX:+UseConcMarkSweepGC;-XX:CMSInitiatingOccupancyFraction=75;-XX:+UseCMSInitiatingOccupancyOnly;-XX:+AlwaysPreTouch;-Xss1m;-Djava.awt.headless=true;-Dfile.encoding=UTF-8;-Djna.nosys=true;-XX:-OmitStackTraceInFastThrow;-Dio.netty.noUnsafe=true;-Dio.netty.noKeySetOptimization=true;-Dio.netty.recycler.maxCapacityPerThread=0;-Dlog4j.shutdownHookEnabled=false;-Dlog4j2.disable.jmx=true;-Djava.io.tmpdir=C:\Users\appveyor\AppData\Local\Temp\elasticsearch;-XX:+HeapDumpOnOutOfMemoryError;-XX:+PrintGCDetails;-XX:+PrintGCDateStamps;-XX:+PrintTenuringDistribution;-XX:+PrintGCApplicationStoppedTime;-Xloggc:logs/gc.log;-XX:+UseGCLogFileRotation;-XX:NumberOfGCLogFiles=32;-XX:GCLogFileSize=64m
The service 'elasticsearch-service-x64' has been installed.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 ShimGen has successfully created a shim for elasticsearch-service-mgr.exe
 ShimGen has successfully created a shim for elasticsearch-service-x64.exe
 The install of elasticsearch was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\elasticsearch\tools'
Chocolatey installed 2/2 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
elasticsearch-service-x64 start
Command exited with code 5

1 个答案:

答案 0 :(得分:1)

重试应该让它更稳定:

- appveyor-retry elasticsearch-service-x64 start