Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: failures due to an extra "%402" character in the location address

My runs are failing, I think due to existence of this suspicious character "%402" in the location addresses. When I check the folder name via terminal this folder name does not exist, while it appears in the Jenkins logs. I wonder anyone has similar experiences.

Here is a snippet from the error log:

Results :

Tests in error: 
  testMultiThreading(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
  testAddView(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
  testSimpleGazetteerAnnotatorString(edu.illinois.cs.cogcomp.edison.annotators.SimpleGazetteerAnnotatorTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
  testNonLazy(edu.illinois.cs.cogcomp.edison.annotators.AnnotatorLazyInitTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)
  testLazy(edu.illinois.cs.cogcomp.edison.annotators.AnnotatorLazyInitTest): java.io.FileNotFoundException: /home/mangipu2/.jenkins/workspace/cogcomp-nlp%402/edison/target/classes/testgazetteers/names (No such file or directory)

And the full error log: http://morgoth.cs.illinois.edu:8080/job/cogcomp-nlp/74/console

like image 301
Daniel Avatar asked Sep 18 '16 02:09

Daniel


3 Answers

Edit : Post totally rewrited with the solution.

When you use the "ws" directive in your Jenkinsfile, Jenkins creates multiple workspace folder to execute concurrent build :

  • jobName_branch-generated_key@2
  • jobName_branch-generated_key@2@tmp
  • jobName_branch-generated_key@script

You can get more informations on this thread.

The hexadecimal code for the special character "@" is "%40", so the extra character that you see is in fact this "@2" suffix with the encoded "@".

I've analyzed the source code of Jenkins and see that you can override the default character "@" used to build the suffix.

To solve this problem you just have to add the system property "-Dhudson.slaves.WorkspaceList=${new_character}" when you launch your Jenkins Server.

Here is the line of code that load the property from system.

like image 200
Matthieu Saleta Avatar answered Oct 15 '22 07:10

Matthieu Saleta


I can see Perforce (P4 Plugin) doesnt like it when there is this @

I am using Amazon Linux so this is what I did to get it working

sudo nano /etc/sysconfig/jenkins
# Added This line
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Duser.timezone=America/Los_Angeles -Dhudson.slaves.WorkspaceList='_'"
like image 32
Moe Hussein Avatar answered Oct 15 '22 08:10

Moe Hussein


I ran into the same problem, but didn't have access to change the Jenkins config. I was able to get it working by manually defining a custom workspace for each sub-stage.

stage('stage1'){
  agent {
    node {
      label 'master'
      customWorkspace "${BUILD_TAG}-id"
    }
  }
}
like image 38
Florian Enner Avatar answered Oct 15 '22 07:10

Florian Enner