Jenkins: console output characters - jenkins

Does anyone know how to beat such chars in Jenkins console output log?
Seems there is a problem with UTF-8.

The issue here is that the characters are not being output as UTF-8 to your console. I think the solution is to tell jenkins when you invoke it to write output as UTF-8. See this solution for a similar problem UTF-8 char encoding does not work on console (Linux)
Something like
java -Dfile.encoding=UTF-8 jenkins.war might do the trick

In Jenkins ver. 2.46.2, I just got this to work by going to Nodes, Advanced settings, JVM Options and putting -Dfile.encoding=UTF8 and then taking that node offline and online again. Hope this helps other people. It would be great if UTF8 support was default.

To give the the answer more complete.
If you use an tomcat container to run jenkins, then edit catalina.sh config file:
vim apache-tomcat-path/bin/catalina.sh
Add -Dfile.encoding=UTF-8 to the JAVA_OPTS var and restart tomcat will do the trick.

For those who are using a build-agent and a pipeline, add this to the agent's dockerfile, and no further jenkins settings are needed
ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8

Try to change the encoding with you are opening your file to 'utf-8' and check your encoding saved for the script in vs code(whatever platform)
enter image description here

I've tried everything with file.encoding variable, but didn't work.
My solution was to check environment locale variables in Jenkins Controller and Agent node where job is actually runing, and make them match.
In my case, agent node running the job required environment variable "LC_ALL=C.UTF-8", which was already defined in controller node.
More details here: https://stackoverflow.com/a/68217405/3284482

Try using AnsiColor plugin in Jenkins. This worked for me. I had tried all the above solutions but nothing happened. As I downloaded AnsiColor plugin everything got fixed!

Related

Jenkins Master: Updating plugin data fails

On my Jenkins Master, versio 2.203, when I'm trying to update the plugins, I have this error:
java.security.cert.CertificateException: No subject alternative DNS name matching updates.jenkins.io found.
at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:207)
at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:98)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:429)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:625)
I have tried the option JENKINS_JAVA_OPTIONS ="(..) -Djsse.enableSNIExtension=false" but didn't work.
Any idea what I can do?
Thank you.
Removing -Djsse.enableSNIExtension=false from the Jenkins Java options fixed it for me. On Ubuntu, I went to the etc/default/jenkins file, located JAVA_ARGS and removed -Djsse.enableSNIExtension=false from this line. You need to reboot the mahcine after that for the new settings to get in effect before you try to update the plugins again on Jenkins.

I can't change java memory for Jenkins

Note: My OS Debian 7, Java 8, 2Gb RAM
Here is what I did:
I went this way: /etc/default/
Then: vim jenkins
Then edit: JAVA_ARGS="-Xmx1048m"
I exit from editor with saving: :wq
Now I make do: service jenkins restart
Now I go to my Jenkins and watching monitoring with plugin JavaMelody.
So, I see that no changes have occurred.
I ask for help in this case, please.
From the official guide, if you're using RedHat Linux based distributions, you should use JENKINS_JAVA_OPTIONS.
JENKINS_JAVA_OPTIONS="-Xmx1048m"
Note: For me, the file location was /etc/sysconfig/jenkins and it only had JENKINS_ARGS="". Assigning Xmx value to it did not work. You should leave that entry as is and instead, add the JENKINS_JAVA_OPTIONS entry in the file just like i specified above.
The problem is resolved and I did the following:
I went this way: /etc/default/
Then: vim jenkins
I'm add in jenkins JAVA=/usr/bin/java
and JAVA_ARGS="-Djava.awt.headless=true -Xmx1024m"
I exit from editor with saving: :wq
Then after I made: service jenkins restart
Now I go to my Jenkins and watching monitoring with plugin JavaMelody.
So, I see that this works for me.
I'm hope this helps someone.

Get HostName in .jtl file in Jmeter

I am using ANT (build tool) to run jmeter functional scripts. I want to get the hostname or website name where all my jmeter scripts are running.
I have checked the jmeter.properties file to do some changes but no luck but no luck.
I fixed and I want to share solution.
I have uncommented the configuration in jmeter.properties.
jmeter.save.saveservice.hostname=true
so that the hostname will be written to the jtl file and from the jtl file, i got it by xpath as below,
/testResults/httpSample/#Host
Thats it, you can use this as xsl variable for reporting or for any purpose.
You can use below inbuilt functions in JMeter.
${__machineName} - to get the machine name
${__machineIP} - to get the IP address

Jenkins service start error on red hat linux

The jenkins service does not start when ever i run jenkins service start . It says
Starting Jenkins bash: /usr/bin/java: No such file or directory
[FAILED]
I have java installed at /usr/lib/jvm/jdk1.7.0_51. The JAVA_HOME variable is also set. Also tried adding this java to /etc/init.d/jenkins file. I need to use the sun jdk, not open jdk.
Tried some of the alternatives from stackoverflow as well but did not work out.
Any suggestions will be of great help.
Thanks,
Bhargav
Thanks Paul. The script inside /etc/sysconfig/jenkins needs to be edited. Else it uses the default java.
JENKINS_JAVA_CMD="path of java installation"
Along with the above script, one can make changes to /etc/init.d/jenkins file if needed to add the path of java installation in your system.
I'd guess that there's a script that has /usr/bin/java hardcoded. When you find the culprit, remove the /usr/bin so that it uses the default. Or you can change it to use the JAVA_HOME path, something like this:
JAVA_EXECUTABLE=$JAVA_HOME/bin/java
$JAVA_EXECUTABLE $JAVA_OPTS etc.. etc..

Setting CATALINA_OPTS for tomcat6 on windows doesn't work

I'm trying to setup Tomcat6 to work with JMX on Windows Vista 64.
To do that I need to pass the parameters below to Tomcat6.
What I do in command prompt. (that doesn't work)
set CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9898 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
tomcat6.exe
What I do that does work (but causes other problems)
java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9898 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar bootstrap.jar
It seems as if tomcat is just ignoring the environment variable CATALINA_OPTS.
Am I doing something wrong?
--- Update - Since writing this i've tried to edit catalina.bat and define the variable CATALINA_OPTS there. No success. (tried adding the parameters to JAVA_OPTS too, no success either)
Thanks in Advance!!
Ignoring the possibility that TC6 could be broken in that environment as I can't check it myself, there are a couple of things you can check:
You have two - characters in your CATALINA_OPTS line in the first parameter, should be one. That would break it, I expect.
If not that:
Is anything else in your Tomcat startup script overwriting CATALINA_OPTS?
Silly me, I started tomcat with tomcat6.exe instead of startup.bat.
Now works.
Thanks!

Resources