jenkins内置变量的使用
参考链接: https://www.cnblogs.com/puresoul/p/4828913.html
一、查看Jenkins有哪些环境变量
1、新建任意一个job
2、增加构建步骤:Execute shell 或 Execute Windows batch command
3、点击输入框下方的“可用环境变量”

4、可以看到有如下变量供使用:
| 变量名 | 解释 |
| BUILD_NUMBER | The current build number, such as "153" |
| BUILD_ID | The current build ID, identical to BUILD_NUMBER for builds created in 1.597+, but a YYYY-MM-DD_hh-mm-ss timestamp for older builds |
| BUILD_DISPLAY_NAME | The display name of the current build, which is something like "#153" by default. |
| JOB_NAME | Name of the project of this build, such as "foo" or "foo/bar". (To strip off folder paths from a Bourne shell script, try: ${JOB_NAME##*/}) |
| BUILD_TAG | String of "jenkins-${JOB_NAME}-${BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification. |
| EXECUTOR_NUMBER | The unique number that identifies the current executor (among executors of the same machine) that’s carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1. |
| NODE_NAME | Name of the slave if the build is on a slave, or "master" if run on master |
| NODE_LABELS | Whitespace-separated list of labels that the node is assigned. |
| WORKSPACE | The absolute path of the directory assigned to the build as a workspace. |
| JENKINS_HOME | The absolute path of the directory assigned on the master node for Jenkins to store data. |
| JENKINS_URL | Full URL of Jenkins, like http://server:port/jenkins/ (note: only available if Jenkins URL set in system configuration) |
| BUILD_URL | Full URL of this build, like http://server:port/jenkins/job/foo/15/ (Jenkins URL must be set) |
| SVN_REVISION | Subversion revision number that's currently checked out to the workspace, such as "12345" |
| SVN_URL | Subversion URL that's currently checked out to the workspace. |
| JOB_URL | Full URL of this job, like http://server:port/jenkins/job/foo/ (Jenkins URL must be set) |
二、使用Jenkins的内置变量
1、在Execute shell 或 Execute Windows batch command文本框中使用,使用方法:%变量名%,如下图

2、结合Ant,在build.xml文件中使用:
1、添加如下第4行代码:<property environment="env"/>
2、使用方法:${env.WORKSPACE}

1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <project name="ant-test" default="run" basedir=".">
4 <property environment="env"/>
5
6 <target name="clean">
7 <mkdir dir="${env.WORKSPACE}/results/${env.BUILD_ID}" />
8 </target>
9
10 </project>

jenkins内置变量的使用的更多相关文章
- [原]Jenkins(十八) jenkins再出发之jenkins 内置变量
1.选择一个project的config选项: 2.选择build选项卡,选择Execute Windows batch command 3.会出现一个内置变量的list 连接按钮: 4.list表内 ...
- jenkins 内置变量
Jenkins 有一些内置的变量可以使用.主要是: 邮件的配置变量,可以在发送邮件的时候使用. 环境变量 1. 邮件的配置变量 ${GIT_BRANCH} - build 的 Git 分支 ${FIL ...
- Jenkins内置环境变量的使用
一.查看Jenkins有哪些环境变量 1.新建任意一个job 2.增加构建步骤:Execute shell 或 Execute Windows batch command 3.点击输入框下方的“可用环 ...
- Maven系列三Maven内置变量
Maven内置变量说明: ${basedir} 项目根目录(即pom.xml文件所在目录) ${project.build.directory} 构建目录,缺省为target目录 ${project. ...
- Maven的内置变量
Maven内置变量说明: ${basedir} 项目根目录(即pom.xml文件所在目录) ${project.build.directory} 构建目录,缺省为target目录 ${project. ...
- nginx的那些内置变量
nginx在配置文件nginx.conf中可以使用很多内置变量,配置如下: location /info { add_header 'Content-Type' 'text/html'; echo & ...
- Maven内置变量说明
Maven内置变量说明: ${basedir} 项目根目录 ${project.build.directory} 构建目录,缺省为target ${project.build.outputDirect ...
- 学习笔记——Maven 内置变量
Maven内置变量说明: ${basedir} 项目根目录(即pom.xml文件所在目录) ${project.build.directory} 构建目录,缺省为target目录 ${project. ...
- makefile 分析 -- 内置变量及自动变量
makefile 分析1 -p 选项,可以打印出make过程中的数据库, 下面研究一下内置的变量和规则. -n 选项, 只运行,不执行, -d 选项,相当于--debug=a, b(basic), ...
随机推荐
- Dapr + .NET Core实战(八)服务监测
服务监测 分布式服务性能指标,链路追踪,运行状况,日志记录都很重要,我们日常开发中为了实现这些功能需要集成很多功能,替换监控组件时成本也很高. Dapr 可观测性模块将服务监测与应用程序分离.它自动捕 ...
- Stream聚合函数
Stream班介绍 幼稚园开学的第一天,各们家长把小朋友送到了园里,各位小朋友都你看看我,我看看你.有的嚎啕大哭,有的呆若木鸡....这里时候园长安排我拿来小本本记录入园的小朋友.... 记录小朋友 ...
- NOIP 模拟一 考试总结
序列 考场上信心满满的打了nlogn的做法,我以为我稳了.据考试结束1h时发现看错题目了,打成了不连续的子序列.匆匆改了n2logn的做法.考试结束后,我发现我跪了.原来到终点才会发现我做的和人家不是 ...
- 定制个机器人帮你和Ta聊天
自动聊天示例 这是基于200万聊天记录训练出来的,你可以用自己和女朋友的记录训练了试试效果 至于微信机器人怎么用,你可以 GitHub 搜搜看哈 聊天1: user: 在吗? bot: 在 user: ...
- 移动端多个DIV简单拖拽功能
移动端多个DIV简单拖拽功能. 这个demo与之前写的一个例子差不了多少,只是这个多了一层遍历而已. <!DOCTYPE html> <html lang="en" ...
- SQL 居然还能在 Apache ShardingSphere 上实现这些功能?
在去年 10 月 5.0.0-alpha 版本发布之后,Apache ShardingSphere 经历了长达 8 个多月的持续开发与优化,终于在 6 月 25 日正式迎来了 5.0.0-beta 版 ...
- 基于注解实现jackson动态JsonProperty
基于注解实现jackson动态JsonProperty @JsonProperty 此注解用于属性上,作用是把该属性的名称序列化为另外一个名称,如把trueName属性序列化为name,但是值是固定的 ...
- 盘点一下Redis中常用的Java客户端,或者咱们手写一个?
Java中那些Redis的客户端 前面我们的所有操作都是基于redis-cli来完成的,那么我们要在Java中操作Redis,怎么做呢?首先我们先来了解一下Redis Serialization Pr ...
- python中对列表的排序
1.sort()对列表永久性的排序,首字母按照字母表的顺序排列 book=['python','java','c++','web'] book.sort() print(book) 结果如下: 2.向 ...
- SharkCTF2021 BabyGame
web类题. 访问题给页面,页面里没啥信息.抓包,发现: 访问它,发现是一个游戏. F12之后看调试器里的js代码,发现: console.log("balabalabala"); ...