why else block not executing scripted pipeline? - jenkins

I have this if else statement if the condition is true the if statement executed but if the condition is false the else statement not executed
steps{
script{
echo '*Stage3 - Trying to build python program and export the Artifact*'
pyInstallerOutput = bat(returnStdout: true, script: '#python -m PyInstaller -v').trim()
if(!("$pyInstallerOutput".contains('No module named'))){
echo "+ PyInstaller Version: $pyInstallerOutput is up and running. good! building artifact"
directoryName = bat(returnStdout: true,script: '#echo %date:~-4,4%-%date:~-10,2%-%date:~7,2%-%time:~-11,2%%time:~-8,2%%time:~-5,2%').trim()
echo ("+ Current Artifact directory: $directoryName")
artifactResult = bat(returnStdout: true, script: "#python -m PyInstaller --specpath ./artifacts-repo/${directoryName}/spec --distpath ./artifacts-repo/${directoryName}/dist --workpath ./artifacts-repo/${directoryName}/build --onefile ./codes/SayHello.py")
} else{
echo '- PyInstaller not installed on node, trying to install it'
installResult = bat(returnStdout: true, script: '#pip install pyinstaller')
if("$installResult".contains('Successfully installed')){
echo '+ PyInstaller installed successfully, Now building Artifact.'
directoryName = bat(returnStdout: true,script: '#echo %date:~-4,4%-%date:~-10,2%-%date:~7,2%-%time:~-11,2%%time:~-8,2%%time:~-5,2%')
echo ("+ Current Artifact directory: $directoryName")
artifactResult = bat(
returnStdout: true,
script: "#python -m PyInstaller --specpath ./artifacts-repo/${directoryName}/spec --distpath ./artifacts-repo/${directoryName}/dist --workpath ./artifacts-repo/${directoryName}/build --onefile ./codes/SayHello.py"
)
}else{
error('- PyInstaller installation failed, nothing more can be done by pipeline, STOPING')
}
}
}
}
Log when the if condition is true
*Stage3 - Trying to build python program and export the Artifact*
[Pipeline] bat
[Pipeline] echo
+ PyInstaller Version: 5.5 is up and running. good! building artifact
[Pipeline] bat
[Pipeline] echo
+ Current Artifact directory: 2022-10-09-211243
[Pipeline] bat
376 INFO: PyInstaller: 5.5
376 INFO: Python: 3.10.7
384 INFO: Platform: Windows-10-10.0.22000-SP0
386 INFO: wrote ./artifacts-repo/2022-10-09-211243/spec\SayHello.spec
387 INFO: UPX is not available.
389 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Ata '
'System\\AppData\\Local\\Jenkins\\.jenkins\\workspace\\Pipeline-01\\codes']
840 INFO: checking Analysis
841 INFO: Building Analysis because Analysis-00.toc is non existent
841 INFO: Initializing module dependency graph...
843 INFO: Caching module graph hooks...
854 INFO: Analyzing base_library.zip ...
3125 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'...
3188 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'...
4729 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks'...
5910 INFO: Caching module dependency graph...
6004 INFO: running Analysis Analysis-00.toc
6011 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\python.exe
6207 INFO: Analyzing C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\codes\SayHello.py
6209 INFO: Processing module hooks...
6219 INFO: Looking for ctypes DLLs
6221 INFO: Analyzing run-time hooks ...
6222 INFO: Including run-time hook 'C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
6224 INFO: Including run-time hook 'C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py'
6228 INFO: Looking for dynamic libraries
365 INFO: Extra DLL search directories (AddDllDirectory): []
366 INFO: Extra DLL search directories (PATH): ['C:\\Program Files (x86)\\VMware\\VMware Workstation\\bin\\', 'C:\\WINDOWS\\system32', 'C:\\WINDOWS', 'C:\\WINDOWS\\System32\\Wbem', 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\WINDOWS\\System32\\OpenSSH\\', 'C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR', 'C:\\Program Files\\Microsoft VS Code\\bin', 'C:\\Program Files (x86)\\Xshell 7\\', 'C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common', 'C:\\Program Files\\Git\\cmd', 'C:\\Users\\Ata System\\AppData\\Local\\Microsoft\\WindowsApps', 'C:\\Program Files\\JetBrains\\PhpStorm 2022.2.1\\bin', 'C:\\xampp\\php', 'C:\\Users\\Ata System\\AppData\\Local\\GitHubDesktop\\bin', 'C:\\apps\\opt\\spark-3.3.0-bin-hadoop3\\bin', 'C:\\apps\\opt\\spark-3.3.0-bin-hadoop3\\bin', 'C:\\Program Files\\Java\\jdk-17\\bin']
7142 INFO: Looking for eggs
7142 INFO: Using Python library C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\python310.dll
7142 INFO: Found binding redirects:
[]
7144 INFO: Warnings written to C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\build\SayHello\warn-SayHello.txt
7161 INFO: Graph cross-reference written to C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\build\SayHello\xref-SayHello.html
7188 INFO: checking PYZ
7188 INFO: Building PYZ because PYZ-00.toc is non existent
7188 INFO: Building PYZ (ZlibArchive) C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\build\SayHello\PYZ-00.pyz
7392 INFO: Building PYZ (ZlibArchive) C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\build\SayHello\PYZ-00.pyz completed successfully.
7397 INFO: checking PKG
7398 INFO: Building PKG because PKG-00.toc is non existent
7398 INFO: Building PKG (CArchive) SayHello.pkg
8688 INFO: Building PKG (CArchive) SayHello.pkg completed successfully.
8690 INFO: Bootloader C:\Users\Ata System\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
8690 INFO: checking EXE
8690 INFO: Building EXE because EXE-00.toc is non existent
8690 INFO: Building EXE from EXE-00.toc
8690 INFO: Copying bootloader EXE to C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\dist\SayHello.exe.notanexecutable
8693 INFO: Copying icon to EXE
8694 INFO: Copying icons from ['C:\\Users\\Ata System\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico']
8705 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
8705 INFO: Writing RT_ICON 1 resource with 3752 bytes
8705 INFO: Writing RT_ICON 2 resource with 2216 bytes
8705 INFO: Writing RT_ICON 3 resource with 1384 bytes
8705 INFO: Writing RT_ICON 4 resource with 37019 bytes
8705 INFO: Writing RT_ICON 5 resource with 9640 bytes
8705 INFO: Writing RT_ICON 6 resource with 4264 bytes
8705 INFO: Writing RT_ICON 7 resource with 1128 bytes
8707 INFO: Copying 0 resources to EXE
8707 INFO: Embedding manifest in EXE
8707 INFO: Updating manifest in C:\Users\Ata System\AppData\Local\Jenkins\.jenkins\workspace\Pipeline-01\artifacts-repo\2022-10-09-211243\dist\SayHello.exe.notanexecutable
8717 INFO: Updating resource type 24 name 1 language 0
8719 INFO: Appending PKG archive to EXE
8732 INFO: Fixing EXE headers
8947 INFO: Building EXE from EXE-00.toc completed successfully.
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Attemping some cleanup works.
[Pipeline] echo
Log when the if condition not true you can see that the else skipped!!!
*Stage3 - Trying to build python program and export the Artifact*
[Pipeline] bat
C:\Users\Ata System\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe: No module named PyInstaller
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Attemping some cleanup works.
[Pipeline] echo
you can find the complete jenkins file Here

One option is to surround your bat command with a try-catch or a catchError block
catchError {
pyInstallerOutput = bat(returnStdout: true, script: '#python -m PyInstaller -v').trim()
}

Related

jenkins pipleline build error:Cannot open assembly 'MSBuild.exe': No such file or directory

I want to use jenkins pipeline and sonarqube to analysis code. Both jenkins and sonarqube are running in docker.I followed manual:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins to create a pipeline job:
node {
stage('SCM') {
checkout(XXXX)
}
stage('Build + SonarQube analysis') {
def sqScannerMsBuildHome = tool 'msbuild'
withSonarQubeEnv('sonar') {
sh "mono ${sqScannerMsBuildHome}/SonarScanner.MSBuild.exe begin /k:myKey"
sh 'mono MSBuild.exe /t:Rebuild'
sh "mono ${sqScannerMsBuildHome}/SonarScanner.MSBuild.exe end"
}
}
}
when I built this pipeline,I got an error like this:
Cannot open assembly 'MSBuild.exe': No such file or directory.
Here is the build log:
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build + SonarQube analysis)
[Pipeline] tool
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: sonar
[Pipeline] {
[Pipeline] sh
+ mono /var/jenkins_home/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/msbuild/SonarScanner.MSBuild.exe begin /k:myKey
SonarScanner for MSBuild 5.0.4
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
07:36:24.082 Updating build integration targets...
07:36:24.993 Fetching analysis configuration settings...
07:36:25.387 Provisioning analyzer assemblies for cs...
07:36:25.388 Installing required Roslyn analyzers...
07:36:25.592 Provisioning analyzer assemblies for vbnet...
07:36:25.592 Installing required Roslyn analyzers...
07:36:25.655 Pre-processing succeeded.
[Pipeline] sh
+ mono MSBuild.exe /t:Rebuild
Cannot open assembly 'MSBuild.exe': No such file or directory.
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 2
Finished: FAILURE
I checked /var/jenkins_home/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/msbuild directory and can't find MSBuild.exe file.
[file in directory][1]
[1]: https://i.stack.imgur.com/2UcdK.png
How can I solve this problem or How can I use jenkins and sonarqube to analysis C# project

downloaded 'sonarqube-ant-task-2.7.0.1612.jar' and set the classpath using it, but It doesn't work

I tried to analyze code with sonar-scanner which is installed on our Jenkins server with ant-build.
And every time of analyzing we download 'sonarqube-ant-task-2.7.0.1612.jar' from our Nexus repository.
cause we work with closed network.
But there is a problem.
Even the sonarqube-ant-task-2.7.0.1612.jar was dawnloaded(workspace/modules) and I checked it up with ls -al command,
+ curl -u ****:**** http://nexus.adpaas.cloud.samsungds.net/repository/VM/lib/sonarqube-ant-task-2.7.0.1612.jar --output sonarqube-ant-task-2.7.0.1612.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 618k 100 618k 0 0 14.8M 0 --:--:-- --:--:-- --:--:-- 15.1M
+ mv ./sonarqube-ant-task-2.7.0.1612.jar ./workspace/modules
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] echo
Location : /home/jenkins/workspace/portal-space185041/ssd/dev/fw5channel-sonar
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] script
[Pipeline] {
[Pipeline] echo
Build : 20201012.135547
[Pipeline] sh
> git rev-list --no-walk 0af1889ccfbd347f427d3a1d5d15c9a33886e6be # timeout=10
+ ls -al workspace/modules
total 632
drwxr-xr-x 2 jenkins jenkins 152 Oct 12 13:55 .
drwxr-xr-x 3 jenkins jenkins 152 Oct 12 13:55 ..
-rw-r--r-- 1 jenkins jenkins 633825 Oct 12 13:55 sonarqube-ant-task-2.7.0.1612.jar
But, still the analysis use default sonar library located in Jenkins Image like below.
[sonar:sonar] Apache Ant(TM) version 1.10.5 compiled on July 10 2018
[sonar:sonar] SonarQube Ant Task version: 2.2
[sonar:sonar] Loaded from: file:/usr/share/ant/ant-1.10.5/lib/sonar-ant-task-2.2.jar
I also set up the build.xml for Sonar analysis.
<target name="sonar" depends = "init, resources-dev, compile">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path ="./workspace/modules/sonarqube-ant-task-2.7.0.1612.jar.jar"/>
</taskdef>
<sonar:sonar/>
with the sonarqube official annotation above( Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder ), I guess that the latter is valid when I don't set the the former 'classpath' option. isnt it?
although it works well, no errors, I have to make a template. so I need to know exact reason of it.
Anyone knows the reason? Thanks a lot in advance.

Jenkins Finished: FAILURE after Katalon test

I am trying using Jenkins to run Katalon test but I have failure when finish katalon test.
here detail what i have done:
Run Test on Katalon it's work fine no error,
jenkins Failed After runing Katalon test,
Change Jenkinsfile Script with chrome no-sanbox (error)
if you have idea what going on here or find what I miss please let me know, I have work on this few days but still no clue.
here details of my Jenkinsfile, I have declare all variable before.
stage ("Regression Test") {
echo 'regression test'
node ('kre-centos') {
cleanWs deleteDirs: true
checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[credentialsId: 'ci-cd', url: "${katalonRepoUrl}"]], branches: [[name: "${katalonBranch}"]]]
withCredentials([string(credentialsId: 'katalon-api-key', variable: 'secret')]) {
echo "workspace : ${workspace}"
sh """
pwd
ls
/katalon01/katalon-studio-engine/katalonc -noSplash -runMode=console \
-projectPath='${workspace}/${katalonProjectName}' -retry=0 \
-testSuiteCollectionPath="Test Suites/${katalonTestSuiteName}" \
-executionProfile="default" -browserType="Chrome (headless)" \
-apiKey=${secret}
"""
}
}
}
Here details of jenkins log
+ pwd
/katalon01/jenkins-agent/workspace/Framework/framework-katalon
+ ls
build.gradle
console.properties
debug.log
FRM-Katalon.prj
Include
Object Repository
Profiles
Scripts
settings
Test Cases
Test Suites
+ /katalon01/katalon-studio-engine/katalonc -noSplash -runMode=console -projectPath=/katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj -retry=0 '-testSuiteCollectionPath=Test Suites/FRM_Katalon' -executionProfile=default '-browserType=Chrome (headless)' -apiKey= 8490e2f6-9949-4610-b043-*******
Katalon workspace folder is set to default location: /tmp/session-f1cdbf48
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
177 2.4.7.xx-2016111****-e46 = ACTIVE
INFO: Katalon Version: 7.5.2
INFO: Command-line arguments: -runMode=console -projectPath=/katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj -retry=0 -testSuiteCollectionPath=Test Suites/FRM_Katalon -executionProfile=default -browserType=Chrome (headless) -apiKey=******** 8490e2f6-9949-4610-b043-********
INFO: User working dir: /katalon01/jenkins-agent/workspace/Framework/framework-katalon
INFO: Error log: /tmp/session-f1cdbf48/.metadata/.log
INFO: Katalon TestOps server URL: https://analytics.katalon.com
INFO: Katalon Store server URL: https://store.katalon.com
INFO: User home: /katalon01/jenkins-agent
INFO: Java vendor: Oracle Corporation
INFO: Java version: 1.8.0_262
INFO: Local OS: Linux 64bit
INFO: CPU load: 0%
INFO: Total memory: 7316 MB
INFO: Free memory: 1013 MB
Start getting machine ID on Linux
End getting machine ID on Linux c05973d029ca9e78c8*******
Start appending additional signatures
hardwareSerialNumber
osDependentUsername jenkins
End appending additional signatures c05973d029ca9e78c8d1437*****__jenkins
INFO: Machine ID: 6546c254cb38a5280********
Activating...
Start activating offline...
Search for valid offline licenses in folder: /katalon01/jenkins-agent/.katalon/license
The number of valid offline licenses: 0
Offline activation failed.
Start activating online...
Cleaning up workspace
Opening project file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj
Warning! Please run Katalon execution command outside of the project folder.
Generating global variables...
Parsing custom keywords...
Project 'FRM-Katalon' opened
Start reloading plugins...
Katalon version: 7.5.2
Plugin info URL: https://store.katalon.com/api/products/ks?appVersion=7.5.2&appType=ENGINE&licenseType=ENTERPRISE
Start check license task
chromedriver is located at default location: /katalon01/katalon-studio-engine/configuration/resources/drivers/chromedriver_linux64/chromedriver. In case your browser is updated to a newer version, please use this command to update chromdriver: --config -webui.autoUpdateDrivers=true
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512................................0/7(0%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512.0/7(0%)
--------------------------------------------------------------------------------
Launcher status after execution process completed: Running
Start writing execution.uuid file to folder: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512
Start generating JUnit report folder at: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512...
JUnit report were generated at folder: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512...............................4/7(57%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
........................................................................4/7(57%)
--------------------------------------------------------------------------------
Uploading report to Katalon TestOps...
Start sending test result to Katalon TestOps
Uploading log files of test suite collection
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution.uuid
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution0.log
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution.properties
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/JUnit_Report.xml
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/FRM_Katalon/20200814_092512/JUnit_Report.xml
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/FRM_Katalon/20200814_092512/20200814_092512.rp
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512..............................7/7(100%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
.......................................................................7/7(100%)
--------------------------------------------------------------------------------
Katalon TestOps: Start uploading report to Katalon TestOps server: https://analytics.katalon.com
Katalon TestOps - Execution URL: https://analytics.katalon.com/from-ks/execution-result?teamId=50***&projectId=62***&id=6941***
End sending to Katalon TestOps
Report has been sent to Katalon TestOps
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512..............................7/7(100%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
.......................................................................7/7(100%)
--------------------------------------------------------------------------------
Execution completed. Exit code: 1.
Start clean up session
End check license task
End clean up session
Start release license task
License released
End release license task
All launchers terminated
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Posting build status of FAILED to bitbucketERROR: script returned exit code 1
Finished: FAILURE
Here details of Katalon error log
2020-08-14 08:40:21 - [TEST_CASE][FAILED] - Test Cases/Application Controller/TS-001_Login Logout Positive Case: Test Cases/Application Controller/TS-001_Login Logout Positive Case FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: 'http://10.172.**.***:3000/'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at TS-001_Login Logout Positive Case.run(TS-001_Login Logout Positive Case:19)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1597394411452.run(TempTestSuite1597394411452.groovy:37)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'devopstools-katalon', ip: '10.172.**.***', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1127.el7.x86_64', java.version: '1.8.0_262'
Driver info: driver.version: CChromeDriver
remote stacktrace: #0 0x55edd4eed*** <unknown>
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19))
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
... 19 more
Try updating your Chrome options with
ChromeOptions options = new ChromeOptions();
...
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
as suggested here.
UPDATE:
To switch from Katalon keywords to Selenium commands use the DriverFactory library. Add this to the top of your script:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
System.setProperty("webdriver.chrome.driver", "C:\\test\\chromedriver.exe")
ChromeOptions options = new ChromeOptions()
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
WebDriver driver = new ChromeDriver(options)
DriverFactory.changeWebDriver(driver)
For more information see here.

Jsystem test unknown failure using Spirent Test Center

I have some weird problem and don't have a clue about how to solve it.
I run automation tests using the Spirent Test Center API on win slave (64 bit 8GB RAM).
As far as I know test center support only 32bit compilation therefore some of my prerequisites is to get 32Bit java from nexus to slave and point my JAVA_HOME to this directory.
when I start my test and get to the init function of TC I don't get any error and Jenkins skip all other stages and finish the job.
when I connect to the slave via RDP and disconnect the test run as it should.
this is the failure:
11:20:07 [system]
11:20:07 [jsystem] 08:20:07: Initializing STC object (Chassis IP: XXXXXXX)
[Pipeline] unit
11:20:09 Recording test results
11:20:09 No test report files were found. Configuration error?
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE
and after connect and disconnect I get this:
<pre>
[jsystem] 08:12:58: Initializing STC object (Chassis IP: XXXXX)
11:13:37 [jsystem] STC init pass.
11:13:37 [jsystem] 08:13:35: Init cli, host: XXXXX
11:13:37 [jsystem] The supported auth Methods are:
11:13:37 [jsystem] publickey
11:13:37 [jsystem] gssapi-keyex
UPDATE:
I manage to find the error:
11:54:58 An unrecoverable stack overflow has occurred.
11:54:58 #
11:54:58 # A fatal error has been detected by the Java Runtime Environment:
11:54:58 #
11:54:58 # EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x74ca5b9b, pid=4356, tid=0x00000ecc
11:54:58 #
11:54:58 # JRE version: Java(TM) SE Runtime Environment (8.0_151-b12) (build 1.8.0_151-b12)
11:54:58 # Java VM: Java HotSpot(TM) Client VM (25.151-b12 mixed mode windows-x86 )
11:54:58 # Problematic frame:
11:54:59 # C [ucrtbase.dll+0x25b9b]
I try to google it and play with the java heap size but it doesn't help.
I don't see any errors in the reports.
Please assist
I think that the problem occurred because I need that user should be login to the agent.
My solution was to set the following registry keys in order to assure this.
https://support.microsoft.com/en-us/help/324737/how-to-turn-on-automatic-logon-in-windows
or by the script:
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d domainname /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Administrator /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d Pa$$w0rd /f

FileNameFinder().getFileNames fails on one Jenkins node

Getting a list of files from jenkins workspace using groovy fails on one node but it works on another.
Here is the code in the pipeline:
def pd = pwd()
bat "dir $pd"
def bat_files = new FileNameFinder().getFileNames(pd, 'G*.bat')
Output:
C:\Jenkins\Slave\workspace\TestFolder\CodeTestPipe>dir C:\Jenkins\Slave\workspace\TestFolder\CodeTestPipe
Volume in drive C is OSDisk
Volume Serial Number is AAA1-73FA
Directory of C:\Jenkins\Slave\workspace\TestFolder\CodeTestPipe
01/23/2017 05:34 PM <DIR> .
01/23/2017 05:34 PM <DIR> ..
01/23/2017 05:34 PM 4 GOL.bat
1 File(s) 4 bytes
2 Dir(s) 134,906,617,856 bytes free
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
C:\Jenkins\Slave\workspace\TestFolder\CodeTestPipe does not exist.
at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:483)
at org.codehaus.groovy.ant.FileIterator.setNextObject(FileIterator.java:119)
at org.codehaus.groovy.ant.FileIterator.hasNext(FileIterator.java:81)
at groovy.util.FileNameFinder.getFileNames(FileNameFinder.groovy:44)
at groovy.util.FileNameFinder$getFileNames.callCurrent(Unknown Source)
at groovy.util.FileNameFinder.getFileNames(FileNameFinder.groovy:31)
at
Pipelines are executed on the Jenkins master, and only through the magic of remoting-enabled APIs do things happen on the selected node. So File, and everything using File, doesn't work, and never will: It always executes on master.
Source: https://groups.google.com/forum/#!topic/jenkinsci-users/yBiYbwWjg-I
I was able to get the files by using the dir in bat command:
def bat_out = bat( returnStdout: true, script: '#echo off & dir /b G*.bat').trim()

Resources