lundi 19 septembre 2016

How to run Jenkins build as any user

I have a jenkins server that can ssh into several other servers and run foo.pythe script makes a result directory based on the user. Multiple people can ssh into the servers and run the script, the results are placed in the specific user's home directory.For example if user1 & user2 were to run the scrip it would be

user1@bar python foo.py
results are placed in /home/user1/results.uniqueID
user2@bar python foo.py
results are placed in /home/user2/results.uniqueID

Jenkins executes builds with the user jenkins. The script does work and results are placed in /var/lib/jenkins/resutls.uniqueID But users can't track their own results anymore.

I know I can edit /etc/sysconfig/jenkins to change the user, but that doesn't account for multiple users at once. Is it possible for Jenkins to launch builds as the user that logged into the Jenkins GUI? Or is possible to have a pre-build script that that can switch the user before foo.py is executed?

Aucun commentaire:

Enregistrer un commentaire