Highly respected community,
I’ve recently bumped into a necessity of running a Drone CI service. My Drone CI worker have to run some python scripts as a part of CI/CD pipeline, but instead it fails with complaints about ModuleNotFoundError
.
I tried to address this by adding required Python packages to the $PATH
path = [ pkgs.drone-runner-exec pkgs.git pkgs.translate pkgs.python39Full pkgs.python39Packages.pip pkgs.python39Packages.pytest pkgs.python39Packages.setuptools pkgs.python39Packages.wheel pkgs.python39Packages.flask pkgs.python39Packages.flask-restful pkgs.python39Packages.flask-socketio pkgs.python39Packages.portalocker pkgs.python39Packages.flask-swagger pkgs.python39Packages.flask-swagger-ui ];
Systemd unit was built successfully, but it didn’t resolved the issue:
translate
Traceback (most recent call last):
File "/var/www/main.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Traceback (most recent call last):
File "/var/www/main.py", line 1, in <module>
I’ve found a few possible solutions that suggested to add appropriate packages to buildInputs
, but the problem is that in my case I do not want to build any packages. My target is to provision systemd service isolated environment in which script is invoked with all necessary dependencies.
Another thing to keep in mind is that python script is not executed directly from ExecStart
directive of systemd unit. It’s Drone CI worker who is being started by ExecStart
directive and then, while running, it invokes python script under certain conditions.
Would much appreciate any help.
Thanks in advance.