Solve Jenkins error
1 Linux space is not enough
1.1 Error reporting phenomenon
/var/lib/jenkins/workspace/CICD
+ pip3 install -r requirements.txt
/tmp/jenkins17065189145681444047.sh: line 4: pip3: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
1.2 Positioning problem
Type pip3 install -r requirements.txt in /var/lib/jenkins/workspace/CICD and the following error is reported:
Using legacy 'setup.py install' for bson, since package 'wheel' is not installed.
Installing collected packages: Jinja2, importlib-metadata, Flask, bson
ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device: '/home/yys/Downloads/Python-3.9.13/Python/lib/python3.9/site-packages/jinja2'
WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available.
You should consider upgrading via the '/home/yys/Downloads/Python-3.9.13/Python/bin/python3.9 -m pip install --upgrade pip' command.
It can be seen from the error message that it is caused by the lack of space for the execution machine.
1.3 Solutions
reference link
2 bash problems
2.1 Symptoms of the problem
The execution shell of jenkins needs to be executed through /usr/bin/python.
/usr/bin/python -m /usr/bin/pip3 install -r requirements.txt
Jenkins error message:
Build step ‘Execute shell’ marked build as failure
2.2 Problem location
In linux, pip has been added to bash, but jenkins still needs /usr/bin/python to execute
2.3 Solutions
In the configure of jenkins, execute the shell command, add: #!/bin/bash
3 Virtual Environment Issues
3.1 Symptoms of the problem
WARNING: Running pip as the ‘root‘ user can result in broken permissions and conflicting
3.2 Problem location
When using pip to install the python library, we often encounter this situation. It is prompted that running pip as a "root" user may cause permission damage and conflicts. Often because of this problem, we cannot update pip or download the library. Failure
3.3 Solutions
reference link
4 The jenkins build is complete but keeps running in circles
4.1 Symptoms
- Jenkins starts the web background, and the web background can also respond normally.
4.2 Problem location
- Because this task is to start a web service, when it is executed directly on the machine, it directly occupies a terminal.
4.3 Solutions
- Add >/dev/null & after the command to start the web service
5 jenkins automatic deployment, automatically kill the newly started service
5.1 Symptoms of the problem
- Although jenkins built flask successfully, the flask service did not start.
5.2 Cause of the problem
- Jenkins will automatically kill the spawned process after the build is complete
5.3 Solutions
- Add set BUILD_ID=dontKillMe before jenkins executes the command to start the flask service in xshell