Jenkins-Weblogic 12c: How to start Nodemanager with Jenkins - jenkins

I have installed Jenkins.
With a 'Execute shell' Build i am trying to do the following in order to start ./startNodemanager:
cd /home/aram/wblogic_12C/Middleware/Oracle_Home/user_projects/domains/base_domain/bin
./startNodeManager.sh > /home/aram/Documents/null 2>&1 &
./startWebLogic.sh > /home/aram/Documents/null 2>&1 &
Jenkins returns the following error:
Building in workspace /var/lib/jenkins/workspace/StartSOAEnv
[StartSOAEnv] $ /bin/sh -xe /tmp/hudson2590954594213459476.sh
+ cd /home/aram/weblogic_12C/Middleware/Oracle_Home/user_projects/domains/base_domain/bin
/tmp/hudson2590954594213459476.sh: line 2: cd: /home/aram/weblogic_12C/Middleware/Oracle_Home/user_projects/domains/base_domain/bin: Not a directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Has some one had the same issue? How can i reach the ./startNodemanager Script

Related

Jenkins run a shell command when build is failed as a post build action to run failed TestNG plan

I want to rerun, below shell script in the same project, once my build is i completed with errors, so I can rerun my failed test cases in testng-failed.xml.
FILE=./target/surefire-reports/testng-failed.xml
if test -f "$FILE"; then
echo "$FILE exists."
mvn clean test -Dhttp.proxyHost=proxy-dev.aws.skynet.com -Dhttp.proxyPort=8080 -Dproxy-dev.aws.skynet.com -Dhttps.proxyPort=8080 -Dbrowser="${Browser}" -Dbrowser_version="${browser_version}" -Dos_version="10" -Dos="Windows" -Dlocalrun="false" -Dtestxml=FILE
else
echo "$FILE is not there"
fi
But in Jenkins, post build section, I don't see an option to add Execute shell. Please help.
I installed post build plugin , but it's only show for maven projects and not for my free style project.
In free style project, No post steps option.
I managed a walkaround to do this without any plugins and still run in the Jenkins free style project. Add two execute shells and in first shell enter the below shell commands.
export M2_HOME=/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3
export PATH=$PATH:$M2_HOME/bin
mvn --version
cd CommonPagesStorage
mvn clean install -DskipTests
cd ..
cd MultiWebdriverDemo
mvn clean test -Dmaven.test.failure.ignore=true -Dsurefire.suiteXmlFiles=TestSuites/${TestPlanName}
echo "${TestPlanName}is ran"
#Dmaven.test.failure.ignore=true added this so even the script failed it doesn't mark as fail and mark it as unstable and continue.
In the second shell command ,conditionally checks the testng-failed.xml is exists if so run it to run the failed test cases.
cd MultiWebdriverDemo
export M2_HOME=/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3
export PATH=$PATH:$M2_HOME/bin
mvn --version
#this to print current directory.
echo "the second Script executed from: ${PWD}"
if [ -e ./target/surefire-reports/testng-failed.xml ]
then
echo "ok file found pass"
mvn test -Dmaven.test.failure.ignore=true -Dsurefire.suiteXmlFiles=target/surefire-reports/testng-failed.xml
else
echo "file not found passed in first attempt ..."
exit 0
#exit 0 means forcefully mark it as passed
fi
if [ -e ./target/surefire-reports/testng-failed.xml ]
then
echo "Rerun also failed exiting with buil state as failure "
exit 1
#exit 1 means forcefully mark it as failed
else
echo "file not found rerun is passed marking the build as passed ..."
exit 0
fi
S0 even in the second time, my webdriver test case is failed, it's failed build mark as a failure.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.199 s
[INFO] Finished at: 2021-08-12T14:05:36Z
[INFO] ------------------------------------------------------------------------
+ [ -e ./target/surefire-reports/testng-failed.xml ]
+ echo Rerun also failed exiting with buil state as failure
Rerun also failed exiting with buil state as failure
+ exit 1
Build step 'Execute shell' marked build as failure
Archiving artifacts
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Saving reports...
Processing '/var/jenkins_home/jobs/August-FreeStyle/builds/37/testng/testng-results.xml'
100.000000% of tests failed, which exceeded threshold of 0%. Marking build as UNSTABLE
TestNG Reports Processing: FINISH
Finished: FAILURE

Why does my Jenkins pipeline fail with Error code 24

I'm running a basic pipeline that executes pylint on my repository code.
My Jenkins runs on Debian etch, the Jenkins version is 2.231.
At the end of the pipeline, I'm getting the following error :
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 24
Finished: FAILURE
As this page https://wiki.jenkins.io/display/JENKINS/Job+Exit+Status explains, the error code 24 refers to a "too many open files" error.
If I remove the pylint part of the job, the pipelines executes smoothly.
Il tried to configure the limit in /etc/security/limits.conf
jenkins soft nofile 64000
jenkins hard nofile 64000
and in the Jenkins config file /etc/default/jenkins :
MAXOPENFILES=64000
If I put "ulimit -n" in the pipeline, the configured value is displayed but it has no effect on the result that remains : ERROR: script returned exit code 24.
The problem comes from pylint that doesn't return a 0 code even if it ran successfully.
The solution is to use the --exit-zero option when running pylint.
pylint --exit-zero src
Jenkins with pylint gives build failure

build apk with jenkins? error: archive artifacts

I am tring to build an apk from my project that on github. Jenkins is connected with github...
Jenkins takes the project on my jenkins page, build it successfully but when it tries to archive artifacts it generates this error:
There are no matches for "** / *. Apk": "**" exists but "** / *. Apk" no
ERROR: Step ‘Archive artifacts’ failed: No artifact matching the pattern for "** / *. Apk" files was found. Is this a configuration error?
Finished: FAILURE.
I have tried all similar questions, but I can't find a solution.
Try this:
archiveArtifacts allowEmptyArchive: true, artifacts: ${WORKSPACE}/path/to/aps/*.apk

Batch command job works in master but not in slave Jenkins

I have created free style project in jenkins to install msi installer. Free style project has
Parameterized job with string as parameter.
Restrict where this project can be run is enabled and selected the Label
Selected 'Executed windows batch command' in build step
Batch command
#ECHO OFF
IF NOT EXIST "C:\Build\Sample_%buidVersion%.msi" (
echo "The specified build does not exist in path"
EXIT /B 1
) ELSE (
echo "Installation of build" %buidVersion% "is started"
START "" /WAIT msiexec.exe /i "C:\\Build\\Sample_%buidVersion%.msi" /L*V "C:\package.log" ADDSOURCE=ALL /qn
)
IF %errorlevel% NEQ 0 (
echo "Error in installation, Please check C:\package.log for more details"
) ELSE (
echo "The build" %buidVersion% "installation is successful"
)
EXIT
When i execute this in master without applying 'Restrict where this project can be run is enabled and selected the Label' this option the job is successful by running in master but on enabling this and executing it in the slave says error as,
"The specified build does not exist in path."
Build step 'Execute Windows batch command' marked build as failure
Best way to debug is to echo the parameters you're using in order to see where the point of failure is.
Add in the beginning of your script:
echo "C:\Build\Sample_%buidVersion%.msi"
cd C:\Build
dir
and check if the file you're looking for is in the right location with the right name.
Good luck!

Jenkins Job Failing - Overwrite to pass Yslow PhantomJS

I have a build that calls Yslow test. The build fails due to some of the yslow tests fail (which I am aware of).
Is there a way to set it so Jenkins does not mark the build "failed" regardless of the yslow tests?
Shell:
/usr/local/bin/phantomjs yslow.js -i grade -t 50 -f junit http://www.website.com > yslow.xml
Console Output:
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE
You could use the groovyPostbuild plugin for this. Something like the following should work:
if(manager.logContains(".*Build step 'Execute shell' marked build as failure.*")) {
manager.build.#result = hudson.model.Result.SUCCESS
}

Resources