stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.76k stars 175 forks source link

Pipeline execution fails repeatedly "System.InvalidOperationException: Could not find build environment" #915

Closed edwardpmarin closed 4 years ago

edwardpmarin commented 4 years ago

Describe the bug Repeatedly, an error occurs when running the mutation tests on the jenkins pipeline. The temporary solution is to re-execute the pipeline, because the cause of the error could not be identified The error displayed on the console is as follows:

Logs `Restore was successful. /opt/dotnet-sdk-3.0.100-linux-x64/dotnet dotnet-stryker -cp ../stryker-config.json -tb 99 --project-file=Project.Application.csproj


/ | | | | | \ | | | | | ( | | _ _ _| | ___ _ | | | | | |
_ | | '| | | | |/ / \ '| | . ` | | | |
____) | |
| | | || | < / | | |\ | |__ | |
|__
/ _|| _, ||__|| ()|| \|____| ||
/ |
|
/

Version: 0.15.0 (beta)

[16:59:53 INF] The project /var/lib/jenkins/workspace/_chore_set-mutaiton-score_MM-723/Project.Application/Project.Application.csproj will be mutated [16:59:54 ERR] An error occurred during the mutation test run System.InvalidOperationException: Could not find build environment at Buildalyzer.Environment.EnvironmentFactory.GetBuildEnvironment(String targetFramework, EnvironmentOptions options) at Buildalyzer.Environment.EnvironmentFactory.GetBuildEnvironment(String targetFramework) at Buildalyzer.ProjectAnalyzer.Build(String targetFramework) at Buildalyzer.ProjectAnalyzer.Build() at Stryker.Core.Initialisation.ProjectFileReader.AnalyzeProject(String projectFilePath, String solutionFilePath) at Stryker.Core.Initialisation.InputFileResolver.ResolveInput(StrykerOptions options) at Stryker.Core.Initialisation.InitialisationProcess.Initialize(StrykerOptions options) at Stryker.Core.StrykerRunner.RunMutationTest(StrykerOptions options, IEnumerable`1 initialLogMessages) [16:59:54 INF] Time Elapsed 00:00:05.1448309 [Pipeline] sh ++ cd Project.Application.UnitTest ++ pwd

Expected behavior The error is expected to be clearer for analysis. Additionally, it is a mistake that should not be presented sporadically as it happens at this time,

Desktop (please complete the following information):

Additional context

rouke-broersma commented 4 years ago

This looks like an error in a dependency we use called buildalyzer. We have not experienced this before so I do not know what went wrong. We'll look into it!

rouke-broersma commented 4 years ago

Hey! We have not been able to find a cause for this problem, other than buildalyzer not being able to detect msbuild or dotnet core on your system. Are you always using the same jenkins slaves for these runs or could there be differences in the build environments?

We have also recently updated buildalyzer, does this issue still persist if you update to a newer stryker version?