一、查看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}

 <?xml version="1.0" encoding="UTF-8"?>

 <project name="ant-test" default="run" basedir=".">
<property environment="env"/> <target name="clean">
<mkdir dir="${env.WORKSPACE}/results/${env.BUILD_ID}" />
</target> </project>

Jenkins内置环境变量的使用的更多相关文章

  1. shell里的IFS内置环境变量

    IFS 的全称是 Interal Field Separator ,即“内部区域分隔符”,它也是一个内置环境变量,存储着默认的文本分隔符,默认下这分隔符是空格符(space character),制表 ...

  2. jenkins 内置变量

    Jenkins 有一些内置的变量可以使用.主要是: 邮件的配置变量,可以在发送邮件的时候使用. 环境变量 1. 邮件的配置变量 ${GIT_BRANCH} - build 的 Git 分支 ${FIL ...

  3. jenkins内置变量的使用

    参考链接:  https://www.cnblogs.com/puresoul/p/4828913.html 一.查看Jenkins有哪些环境变量 1.新建任意一个job 2.增加构建步骤:Execu ...

  4. GLSL语言内置的变量详解

    GLSL语言内置的变量,包括内置的顶点属性(attribute).一致变量(uniform).易变变量(varying)以及常量(const),一方面加深印象,另一方面今天的文章可以为以后的编程做查询 ...

  5. Flask内置URL变量转换器

    Flask内置URL变量转换器: 转换器通过特定的规则执行,”<转换器: 变量名>”.<int: year>把year的值转换为证书,因此我们可以在视图函数中直接对year变量 ...

  6. MySQL-配置环境变量及修改密码(附-mysql安装教程)

    MySQL-配置环境变量和修改密码 mysql的安装教程:链接:https://pan.baidu.com/s/1rrPT2X0yRF58kN8jZZx-Mg 密码:55dh 一. 闪退问题 1.1. ...

  7. [原]Jenkins(十八) jenkins再出发之jenkins 内置变量

    1.选择一个project的config选项: 2.选择build选项卡,选择Execute Windows batch command 3.会出现一个内置变量的list 连接按钮: 4.list表内 ...

  8. [Jenkins] 如何修改jenkins上的环境变量

    现象 当本地的环境变量发生变化时,在jenkins 构建时里面访问的环境变量仍是之前旧的(未更新的)导致构建出现错误,比如我以我所遇到的问题进行简单写下,下面例子中我是涉及到修改 PYTHONPATH ...

  9. osg内置shader变量

    uniform int osg_FrameNumber:当前OSG程序运行的帧数: uniform float osg_FrameTime:当前OSG程序的运行总时间: uniform float o ...

随机推荐

  1. matlab-非线性拟合函数lsqcurvefit的使用和初值选取

    所解决问题: 我们知道我们的表达式是y=A+B*exp(-x.^2)-C./log(x), 而且现在我们手里面有x与y对应的一大把数据. 我们需要根据x, y的值找出最佳的A.B.C值.则我们现在借助 ...

  2. java网络编程-单线程服务端与客户端通信

    该服务器一次只能处理一个客户端请求;p/** * 利用Socket进行简单服务端与客户端连接 * 这是服务端 */public class EchoServer { private ServerSoc ...

  3. PHP/TP5 接口设计中异常处理

    PHP提供 Exception 类来处理异常 new Exception('错误信息(默认为空)','错误代码(默认0)','异常链中前一个异常') 然后可以通过 e -> getMessage ...

  4. 同步锁Lock(互斥锁)

    同步锁作用: 在我当前包含(lock.acquire() 和 lock.release()之间 )的代码没有执行完成,不进行线程切换,必须等我执行完了,下一个线程才能继续执行(为什么要用同步锁,假如我 ...

  5. ==、equals和hashCode小结

    1.== ==是关系操作符,对于基本类型(byte,short,char,int,long,float,double,boolean),比较的是值是否相等:对于对象,比较的是对象的引用(也即栈内存中的 ...

  6. html css col-md-offset

    有的时候,我们不想让两个相邻的列挨在一起,这时候利用栅格系统的列偏移(offset)功能来实现,而不必再定义margin值.使用.col-md-offset-*形式的样式就可以将列偏移到右侧.例如,. ...

  7. linux安装rabbitmq3.6.5

    一.准备依赖包 yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ k ...

  8. EOS.IO Technical White Paper v2

    [EOS.IO Technical White Paper v2] Abstract: The EOS.IO software introduces a new blockchain architec ...

  9. mysql 库 表 和 时间查询

    -- 查询 worker 库中 表 和 视图 select table_name from information_schema.tables where table_schema='worker' ...

  10. Linux 上pcntl安装步骤

    一. 下载对应的PHP源码包 wget http://cn2.php.net/get/php-5.5.20.tar.gz/from/this/mirror 二. 解压下载的源码文件 tar -zxvf ...