After opening the report, the interface style is messed up, as follows:
Cause Analysis
The reason for this phenomenon lies in Jenkinsthe configuration CSP(Content Security Policy);
This is Jenkinsa security policy that is set to a very strict permission set by default to prevent Jenkinsusers workspace、/userContent、archived artifactsfrom being attacked by malicious HTML/JSfiles;
After entering the command and running it, if it is empty, it means the configuration is complete, as follows:
Build again. At this time, the interface style displays OK, as follows:
The above operation is effective for reports generated by previous builds HTML, and is only temporarily effective. When restarted Jenkins, Content Security Policyit will be restored to the default value, and HTMLthe style will no longer be displayed.
permanent strategy
Install Groovythe plug-in as follows:
Go to Project-Configuration- Execute Groovy script:
For example, when building, it is prompted that the report path does not exist and needs to be created manually. The error message is as follows:
Jenkins - HTML Publisher Plugin build fails with report directory doesnot exist
Cause Analysis
Either the report directory you set does not exist in the project directory of the remote warehouse;
Either the report directory you set is inconsistent with the report path stored in the warehouse.
solution strategy
Set the directory where reports are stored on Jenkins. The following is the directory under the project root directory reports:
Then confirm whether there is the same directory under the directory of the project in the warehouse:
As above, there is report in my warehouse, so the two need to be consistent, either yes reportor both reports;
Finally, confirm jenkinswhether the project directory in the container is successfully downloaded or synchronized. You can enter jenkinsthe container to view it with the following command:
sudo docker exec-it jenkins bash
ls /var/jenkins_home/workspace/test_autoui -ls
# /var/jenkins_home/workspace/:这是jenkins容器上项目的工作空间# test_autoui:这是我的项目名称,改为自己的即可
You can see from the above that there is reporta directory and view the reports inside:
Only by ensuring that the above points are consistent can the report be displayed normally, because the console information has already given a prompt during the build. It is copied from a certain directory to a zero-one directory:
Phenomenon 3: Docker and operating system versions do not match
The above two phenomena have been solved, but the report is still not displayed, and the data on the report page is directly displayed blank;
Cause Analysis
View the error message output on the console during build:
That is, the error message is:
lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by docker)
This is because the docker version and the operating system version do not match. My environment is:
docker:最新版本
Ubuntu:22.04
After consulting the magnetic information, it is possible Ubuntu:22.04to use it if necessary due to the problem Ubuntu18.04、Ubuntu20.04.
solution strategy
Reinstall the system, such as using Ubuntu18.04、Ubuntu20.04.