jenkin 获取构建用户名
1. Jenkins获取运行job的用户名
需要安装 build-user-vars-plugin 插件,然后就可以取到$BUILD_USER_ID变量。
user build vars plugin下载地址:
https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin
可以使用的用户变量:
Variable | Description |
---|---|
BUILD_USER | Full name (first name + last name) |
BUILD_USER_FIRST_NAME | First name |
BUILD_USER_LAST_NAME | Last name |
BUILD_USER_ID | Jenkins user ID |
BUILD_USER_GROUPS | Jenkins user groups |
BUILD_USER_EMAIL | Email address |
怎么使用:
在配置中,选中
在shell 中直接引用:
#!/bin/bash
echo -------------
echo ${BUILD_USER}
echo ${BUILD_URL}
(1)
http://ip:8080/job/test%E4%BA%8C%E7%BB%B4%E7%A0%81/41/api/xml
欢迎来撩 : 汇总all