Tag Archives: Jenkins

[Solved] Jenkins Publish to rancher Error: ERROR: Build step failed with exception java.lang.ClassCastException: class com.

error message

ERROR: Build step failed with exception
java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.NullNode cannot be cast to class com.fasterxml.jackson.databind.node.ObjectNode (com.fasterxml.jackson.databind.node.NullNode and com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module of loader jenkins.util.AntClassLoader @3e61f18f)
	at io.jenkins.plugins.rancher2.Rancher2RedeployBuilder.perform(Rancher2RedeployBuilder.java:136)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
	at hudson.model.Build$BuildExecution.build(Build.java:198)
	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
	at hudson.model.Run.execute(Run.java:1888)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:99)
	at hudson.model.Executor.run(Executor.java:432)
Build step 'Redeploy Rancher2.x Workload' marked build as failure

How to Solve:

When publishing to the router, the corresponding node cannot be found, so confirm whether the router path configuration in jenkins is correct. The following two paths must be consistent:

The router configuration in jenkins

The actual router path

[Solved] error“:“element click intercepted“,“message“:“element click intercepted“

Error reporting: Selenium project can run locally, and there is no graphical use case execution error on Jenkins deployed in CentOS virtual machine: element click intercepted

Troubleshooting ① first check whether the browser and driver versions match

Browser driver download address: http://chromedriver.storage.googleapis.com/index.html

Troubleshooting ② check whether there are chrome processes that have not been closed. If there are, you need to kill them in batches

 kill -9  $(pgrep chrome) 

Troubleshooting ③ if the driver version matches, report and correct the error. Add the following code, with the focus on adding window size

chrome_options = Options()
chrome_options.add_argument('--headless')     # To open the browser, comment out the line of code
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("--window-size=1920,1080")  # Error reported when adapting jenkins build{"error":"element not interactable"}
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_options=chrome_options)

Build successful

[Solved] selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn

1. Phenomenon: Jenkins cannot call out the browser page when building selenium, and Jenkins reports an error when building selenium: selenium.common.exceptions WebDriverException: Message: unknown error: DevToolsActivePort file doesn’t exist

2. Troubleshooting: run the project code directly under the Jenkins working directory, call out the browser normally, and the use case execution is completed

3. Reason: after Jenkins is built, the default node for running automation cases is the master, and the processes running on the master are background processes, so you can’t see the browser running interface

4. Solution:

① build the project in a graph free way
② add a slave node to Jenkins and point the project construction node to slave

Using Jenkins to compile APK Error [How to Solve]

In the past, the project could be built on Jenkins normally. Today, it is suddenly found that the construction is wrong. The problems are as follows:

Could not determine the dependencies of task ':lint'.
> Could not resolve all artifacts for configuration ':releaseUnitTestCompileClasspath'.
   > Could not resolve junit:junit:4.+.
     Required by:
         project :
      > Failed to list versions for junit:junit.
         > Unable to load Maven meta-data from http://jcenter.bintray.com/junit/junit/maven-metadata.xml.
            > Could not get resource 'http://jcenter.bintray.com/junit/junit/maven-metadata.xml'.
               > Could not GET 'https://jcenter.bintray.com/junit/junit/maven-metadata.xml'.
                  > org.apache.http.client.ClientProtocolException (no error message)
      > Skipped due to earlier error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Gradle plug-in version 4.1.2, gradle version 6.5

The solution to this problem is as follows:

1. Find the build.gralle file of moudle.

Modify testImplementation 'junit:junit:4.+' to testImplementation 'junit:junit:4.12'

2. Find the following places in the gradle compilation file used by Jenkins server and modify it to the following information

allprojects {
    repositories {
        jcenter { url "http://jcenter.bintray.com/"}
        google()
        maven { url 'http://repo1.maven.org/maven2' }
    }
}

Then use Jenkins to build again, and the APK can be built normally.

[Solved] Jenkins build error: esbuild install failed

When building the front-end package of the company’s test environment, an error was suddenly reported and the construction failed. After checking the log, an error was reported and the esbuild installation failed. I have not installed this esbuild on Jenkins server, and the code proposed by the development is no problem.
solution:
first look for the esbuild directory in the front-end package. I found that there are two esbuild directories in my front-end package, and then I went in and found that there are install JS file, NPM – V check your own NPM version. If it is greater than 7, execute
node node_modules/esbuild/install.js
after manual installation, build from Jenkins again, and there will be no error

[Solved] source /etc/profile Error: not a valid identifier

During the recent web automation test, I used Jenkins, a continuous integration tool, and then added my own alicloud server as the node, which is CentOS server. I am ready to install allure and configure the environment variables for it. I have set the environment variables myself, as shown below

-Use the source command to activate the environment variable

source /etc/profile

As a result, the following errors are reported

 

Solution:

Go directly to ~/.bash_profile to add environment variables, then go to activate it, and finally use the following command, go to enter, you can see my alure installation successfully

allure --version

[Solved] Jenkins error: Asynchronous execution failure

The job normally builds success, and then reports asynchronous execution failure, as shown below

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.983 s
[INFO] Finished at: 2022-01-12T09:56:29+08:00
[INFO] ------------------------------------------------------------------------
ERROR: Asynchronous execution failure
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at hudson.remoting.Channel$2.adapt(Channel.java:1037)
	at hudson.remoting.Channel$2.adapt(Channel.java:1031)
	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:60)
	at hudson.maven.AbstractMavenBuilder.waitForAsynchronousExecutions(AbstractMavenBuilder.java:186)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:144)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
ERROR: Asynchronous execution failure
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at hudson.remoting.Channel$2.adapt(Channel.java:1037)
	at hudson.remoting.Channel$2.adapt(Channel.java:1031)
	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:60)
	at hudson.maven.AbstractMavenBuilder.waitForAsynchronousExecutions(AbstractMavenBuilder.java:186)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:144)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Solution: find the fingerprints folder in Jenkins’s home directory, delete the contents, and then build without reporting an error.

[Solved] jenkins-deleteDir Error (FilePath is missing)

Today’s development feedback has been using the good Jenkins compilation service, but it reported an error

Look at the log and say something is wrong with deletedir

org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node

Then after development and adjustment

Start reporting another error

After developing no solution, he found me

I looked at the pipeline

pipeline {
    agent{ label 'qa-gpu016.test.cn' }
    parameters {
        string(defaultValue: '0.0.0', description: '版本号', name: 'version', trim: false)
    }
......

The discovery task is scheduled to · qa-gpu016 test.cn , and then log in to qa-gpu016 test.cn View

It was found that the disk was full. Because I didn’t know who to clean, I could only clean some unused images and containers

root@qa-gpu016:/# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              12                  5                   21.67GB             20.58GB (94%)
Containers          6                   6                   4.765MB             0B (0%)
Local Volumes       544                 2                   197.3GB             197.1GB (99%)
Build Cache         0                   0                   0B                  0B
root@qa-gpu016:/home# docker system prune -a 
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all images without at least one container associated to them
        - all build cache
Are you sure you want to continue?[y/N] y
Deleted Containers:
e0a493a142c680033c0bce6eed8e2ee3538b6e967077c6d8e27110d992ae543e
d0283ada7950f92dbf43f02a543a12eb4efc0a1a285516500ae2ccbd87ad58f7
fbaba3555782cace190c5d8c471ab302b0a9ed8372f881899c3c421aaac96a32
facab655ec5f0bc7a1737ced60353be2c6a51a79f80cfcec04bc2b63c802fe5f
095d2f0c22483c7515c2a17bb19489fe4f52cd7251ff865bd23893ae7064e015
db4614f42fe72795335af99b64fbac7f3b41311631d349511b593b186acb6e53
4fc5b1870cb1fb4ddd5197d70b0f80ef8be224229417d0ea7b5e5f3ce94da214
53d9edf531c88c27cb31b0039427cb0bc9f7a5d8806ebda608f7bb604252fcb5
8d150da1189ba204d318cb8e028c47d71df4be0ff23a69bb1fe6a0403e938313

Deleted Images:
untagged: be510_test:0.0.217
deleted: sha256:cc9822c1c293e75b5a2806c2a84b34b908b3768f92b246a7ff415cf7f0ec0f37
deleted: sha256:f21a13c9453fb0a846c57c285251ece8d8fc95b803801e9f982891659217527a
deleted: sha256:38c1da0485daa7b5593dff9784da12af855290da40ee20600bc3ce864fb43fc0
......
root@qa-gpu016:/#

Then inform the developer to remove the judgment and keep it as it is

......
        cleanup {
            /* clean up our workspace */
                deleteDir()
                
            /* clean up tmp directory */
            dir("${workspace}@tmp") {
                deleteDir()
            }
            /* clean up script directory */
            dir("${workspace}@script") {
                deleteDir()
            }
        }
......

Reconstruction, development feedback, pulling an image, and now entering the compilation process. Before, an error was reported on the outside

So far, the problem has been solved

Jenkins error: exception message 137

ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [137]]
Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

At present, there is no better information to support this error. Now record it. Due to too many execution script directories, try to put the script under the remote directory of the remote server

[Solved] allure Error: unrecognized arguments: — alluredir — clean alluredir

An integrated environment has been built locally and runs smoothly. When moving to the ECS for construction, allure always reports an error and prompts that the command is wrong. After repeatedly comparing various modules and versions of python, it is found that they are the same and always report this error

ubuntu@VM-16-9-ubuntu:/var/lib/jenkins/workspace/autotest_daily/pytestdemo$ sudo python3 all.py 
ERROR: usage: all.py [options] [file_or_dir] [file_or_dir] [...]
all.py: error: unrecognized arguments: --alluredir --clean-alluredir
  inifile: /var/lib/jenkins/workspace/autotest_daily/pytestdemo/pytest.ini
  rootdir: /var/lib/jenkins/workspace/autotest_daily/pytestdemo

I searched everywhere but couldn’t find it. I thought there was a problem with the version of allure pytest. Compared with the version number, the version number is the same, because the difference between the two servers lies in the difference of source addresses. Is there any difference in the same version? Stuck here for an hour, execute   Sudo PIP3 install — upgrade allure pytest

Installing collected packages: six, allure-python-commons, allure-pytest
Successfully installed allure-pytest-2.9.45 allure-python-commons-2.9.45 six-1.16.0

The problem is that the version of six is different. Finally, we found a different version. The version of six used for local construction is 1.14.0 and the server is 1.16.0

Attempt to downgrade the version of six

sudo pip3 install six==1.14.0

Then continue to build. When pytest is executed normally, the build is OK. I have to say that there are so many holes in Python.

The question is, what does six do?

I searched it again. This thing is used to be compatible with Python 2 and 3 modules. It can be seen from this,

allure   allure-pytest                     2.9.45
allure-python-commons             2.9.45

The first two modules are incompatible with six 1.16.0, so they bring this kind of pit.

[Solved] Jenkins+Ant Error: Error reading project file xxxxx

My colleague used Jenkins + ant + JMeter to build the interface automation shelf. Today, my colleague asked me to help look at a problem

The error reports are as follows:
error reading project file/var/lib/Jenkins/workspace/2021. M6/build. XML

at first, I thought the file could not be found. Later, I went to the server to check it. The file is in. (after thinking about it carefully, it should be not find if the file cannot be found. This error means that there is an error reading the file. In fact, there is an error reading and writing due to insufficient permissions)
later, I can successfully execute the ant command on the server
after step-by-step analysis and troubleshooting, it is found that it is a problem of permissions. After Jenkins is installed on the server, a user named Jenkins is automatically created. By default, the permissions of this user are also used
when I switch the Linux user to Jenkins and execute the ant command, the above error is reported. The root user will not report an error
therefore, the solution is to increase the permissions of Jenkins to root
1. Add the Jenkins user to the root group

gpasswd -a root jenkins

2[UNK]vim /etc/sysconfig/jenkins

JENKINS_USER="root"
JENKINS_GROUP="root"

3. Restart Jenkins

service jenkins restart

Final effect: