Hi,
Jenkins 2.308
I have a Jenkins job that is triggered remotely from powershell scripts. The job is limited to certain users. When it runs it does NOT display user id, instead it displays “Started by remote host ”
It is working fine, all I want is to log the user that triggered it. I have search and the closest I’ve found is the “&cause=” work around. I would like to get this information from the server and NOT depend on the user to include their userid.
It’s running on a Linux server (Ubuntu 18.04.5 LTS).
I have found user files apiTokenStats.xml and config.xml in
/var/lib/jenkins/users/_#########/
I was hoping there would be something in those config files I could use but haven’t figured it out yet.
This is a snip of the powershell script that calls the job:
…
encrypt credentials
$enc = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(“$($UserName):$($UserToken)”))
header
$header = @{‘Authorization’ = “Basic $enc”}
ur
$url = “https://$server/$job/buildWithParameters?token=$jobtoken&FILE=$file”
kick off build
Invoke-RestMethod -Uri $url -Method ‘Post’ -Headers $header
…