In Jenkins, how do builds know who requested them?

后端 未结 6 1102
南旧
南旧 2021-01-04 01:09

I need to pass the username of the requestor of a build down to the script that is actually doing the work. Looking at the console output for a particular build, the first

6条回答
  •  别那么骄傲
    2021-01-04 01:18

    The username isn't put in an easy-to-fetch environment variable, but you can get it using the xml (or json or python) api - as soon as you start a build, http://[jenkins-server]/job/[job-name]/[build-number]/api/xml is populated with details:

    
        
            
                Started by user foobar
                foobar
            
        
        true
        [...]
    

提交回复
热议问题