jenkins slave runs as user

前端 未结 3 586
攒了一身酷
攒了一身酷 2021-02-07 19:58

I have a jenkins setup with multiple users which are logging in with Active Directory plugin. This is useful so that each user can access his own tasks.

However each use

3条回答
  •  无人及你
    2021-02-07 20:31

    The problem is: there is only one slave process running the different job assigned to that server by the Jenkins master.
    So the slave itself runs as one user (generally, a dedicated account or a system account).

    Since you can get the user id as environment variable (with a plugin like JENKINS Build User Vars Plugin), you might consider configuring the job in order for it build step to "run as" the user who triggered the build.
    See for instance the JENKINS Authorize Project plugin.

    However, as mentioned this answer:

    The "Authorize Project" plugin does not change the OS level user that is running commands.
    It only sets the Jenkins user that is running the job and any downstream jobs, using Jenkins authentication (whatever it might be).

    So you are left with build step with runas or su -c commands in order to be sure that your task does run with the right user.

提交回复
热议问题