2

I have a Jenkins server that gets regularly automatically rebuilt using the contents of /var/lib/jenkins. After running a Robot test, attempting to access the html file results in the following error;

Opening Robot Framework log failed

Verify that you have JavaScript enabled in your browser.

Make sure you are using a modern enough browser. Firefox 3.5, IE 8, or equivalent is required, newer browsers are recommended.

Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.

I am looking for a fix that is either a) a command line fix which I can add to the bootstrapping of the new server, or b) another solution which will work on my existing server (i.e. not require a new (empty) Jenkins server) and persist when the server is refreshed (i.e. the old server terminated, and a new server with the same /var/lib/jenkins started).

I've tried everything in this thread Error: Opening Robot Framework log failed

The only success I have had is running this line in the Script Console;

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")

After running this script I am able to access the html file of any new Robot execution. However the change doesn't persist to a new server.

In order to make this success persistent, I have tried adding the following lines when bootstrapping a new server, and while the no error message gets thrown, the properties do not get changed;

crumb=$(curl --user '<user>:<password>' -X GET http://127.0.0.1:8080/crumbIssuer/api/json | jq -r .crumb)

curl --user '<user>:<password>' -H 'Jenkins-Crumb: $crumb' --data-urlencode 'script=System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")' http://127.0.0.1:8080/script

Am I using the /script incorrectly? Is there another way of setting these parameters via the command line?

Thanks for your help.

UPDATE: I have got one step further: I can now send the command to the script console remotely, and it appears to return the property changes as expected, (i.e. the same changes as if the command is entered manually into the Script Console), BUT the html files fail to open. If the same command is manually entered into the Script Console, the html file opens as expected.

The new commands I am using;

crumb=$(curl --user 'admin:password' -X GET http://127.0.0.1:8080/crumbIssuer/api/json | jq -r .crumb)
echo 'System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")' > script.groovy
curl --user 'admin:password' -H "Jenkins-Crumb: $crumb" --data-urlencode "script=$(<./script.groovy)" http://127.0.0.1:8080/scriptText
confused76
  • 21
  • 5
  • I'd mark this as duplicate but the other question has not been marked as answered. See [How to Permanently Resolve HTML Publisher Plugin issue in Jenkins showing Extent Reports? ](https://stackoverflow.com/questions/57362137/how-to-permanently-resolve-html-publisher-plugin-issue-in-jenkins-showing-extent/57367941#57367941) – Ian W Aug 06 '19 at 19:57

0 Answers0