简体   繁体   English

Jenkins 到 Linux 问题 - Python 文件执行

[英]Jenkins to Linux Issues - Python File execution

I am quite new to linux set up and I am finding it really tough to make my jenkins machine talk to a python program residing in a linux server.我对 linux 设置非常陌生,我发现让我的 jenkins 机器与驻留在 ZE08650CC 服务器中的 python 程序对话非常困难。 Here are the details:以下是详细信息:

  • I have a python file which resides in a path '/filenet/EFBI/Scripts/Test_Scripts/add.py'我有一个 python 文件,它位于路径“/filenet/EFBI/Scripts/Test_Scripts/add.py”中
  • I have created one Jenkins Job to run the add.py file which has the JenkinsHome path set in the same linux machine -'/jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home'我创建了一个 Jenkins 作业来运行 add.py 文件,该文件在同一台 linux 机器中设置了 JenkinsHome 路径 -'/jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home'
  • I donot have access to the workspace file inside the Jenkins_Home (using a user to login to the linux box).我无权访问 Jenkins_Home 中的工作区文件(使用用户登录到 linux 框)。

In the Jenkins Job configuration I have written the below code:在 Jenkins 作业配置中,我编写了以下代码:

#! /usr/local/bin python3
python3 /filenet/EFBI/Scripts/Test_Scripts/add.py

When this gets executed receiving a error:当执行此操作时收到错误:

started by user Jenkins Admin User
Running as System
Building in workspace /jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home/Workspace/PythonTest
[PythonTest] $ /usr/local/bin python3 /jenkins/jenkins_fmlvlm0000/jenkins2_176/apache-tomcat-9.0.20/temp/jenkins123456789.sh
FATAL : command execution failed
java.io.IOException: error=13, Permission Denied
....
....
....
....
caused: java.io.IOException: cannot run program "/usr/local/bin" (in directory "/jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home/Workspace/PythonTest"): error=13, Permission Denied

Now I have below questions:现在我有以下问题:

  1. Where am I going wrong?我哪里错了?
  2. How to find out which user is being used to interact between jenkins and linux python program?如何找出正在使用哪个用户在 jenkins 和 linux python 程序之间进行交互?
  3. Is this a permission issue and what all permission be required?这是一个权限问题吗?需要哪些权限?

The issue is resolved now.现在问题已经解决了。 We had to create a slave node and then in the linux machine create a worker folder for the agent to work.我们必须创建一个从节点,然后在 linux 机器上创建一个工作文件夹以供代理工作。

And then in the set up create the same user ID and password through which we are logging into to linux machine and then provide required SSH permission to make it work.然后在设置中创建与我们登录到 linux 机器相同的用户 ID 和密码,然后提供所需的 SSH 权限以使其工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM