Here are some basic infos:
- windows server 2016
- CI/CD: jenkins running on windows server 2016
I have a msvc program, I start the building by calling a powershell script. I can run it successfully at local machine. But if I attempt to call the build script in pipeline script, sometimes the pipeline goes well, sometimes the pipeline gets error in the build stage.
Here is the error occurred, but the pipeline goes well.
powershell.exe : build sdk include:C:\Program Files\Huawei\DevEco Studio\sdk\default\openharmony\native\sysroot\usr\include
D:\data\workspace\CTP_COMPILE_develop\ctp\ctp_build@tmp\durable-a9a169cf\powershellWrapper.ps1:3 character: 1
+ & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (build sdk inclu...oot\usr\include:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
There is another siuation when run the robocopy command, if the robocopy ends, the pipeline terminates occasionally.
These two situations won't occur at the same time, mostly is the second, if the second error occurred, the pipeline failed.
The following is my part pipeline script:
String thirdPartySrc = "D:\\deps\\thirdparty"
String thirdPartyDest = "thirdparty"
echo "Copying ctp_thirdparty from ${thirdPartySrc} to ${thirdPartyDest}"
bat """
robocopy "${thirdPartySrc}" "${env.WORKSPACE}\\${thirdPartyDest}" /MIR /XC /XO /XN
"""
dir("build") {
powershell """
.\\build_targets.ps1 -TARGET_OS harmonyos -TARGET_ARCH x86_64 -INTERACTIVE_MODE 0 -BUILD_TYPE Release
"""
powershell """
.\\build_targets.ps1 -TARGET_OS win -TARGET_ARCH x86_64 -INTERACTIVE_MODE 0 -BUILD_TYPE Release -CLEAN_ALL 1
"""
}
And this is my main part build script:
$cmakeArg = $env:OHOS_CMAKE_COMMON_ARG + "-B `"$BUILD_CACHE_FOLDER/$CURRENT_PROJECT`""
Write-Host "$CURRENT_PROJECT cmakeArg: $cmakeArg"
# compile
Start-Process -NoNewWindow -Wait $env:OHOS_CMAKE_BIN -ArgumentList $cmakeArg
$processReturn = Start-Process -NoNewWindow -PassThru -Wait $env:OHOS_CMAKE_BIN -ArgumentList "--build `"$BUILD_CACHE_FOLDER/$CURRENT_PROJECT`""
if ($processReturn.ExitCode -ne 0) {
Write-Error "Build $CURRENT_PROJECT failed"
cd $ROOT_DIR\${PROJECT_PREFIX}_build
exit 1
}
I think the error may be related to the powershell? How to solve this problem?
$env:OHOS_CMAKE_BIN?$env:OHOS_CMAKE_BINis the path of haromonyos cmake tool bin directory, I have checked the problem that I lose a `\` in thebuild_config.json, I have updated my problem.