一、查看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. __get__ __set__ __delete__描述符

    描述符就是一个新式类,这个类至少要实现__get__ __set__ __delete__方法中的一种class Foo: def __get__(self, instance, owner): pr ...

  2. CSS vertical-align属性详解

    . 首页 博客园 联系我 前言:关于vertical-align属性. 实践出真知. 垂直居中. 第二种用法. 留言评论 返回顶部 前言:关于vertical-align属性 vertical-ali ...

  3. 深度学习原理与框架-猫狗图像识别-卷积神经网络(代码) 1.cv2.resize(图片压缩) 2..get_shape()[1:4].num_elements(获得最后三维度之和) 3.saver.save(训练参数的保存) 4.tf.train.import_meta_graph(加载模型结构) 5.saver.restore(训练参数载入)

    1.cv2.resize(image, (image_size, image_size), 0, 0, cv2.INTER_LINEAR) 参数说明:image表示输入图片,image_size表示变 ...

  4. vim 多行添加注释,取消注释

    转发 已经验证 https://blog.csdn.net/SuiXin_123/article/details/81393397

  5. CSS3 Box-sizing(转载)

    转载自:W3CPLUS Airen的博客:http://www.w3cplus.com/content/css3-box-sizing box-sizing是CSS3的box属性之一.一说到CSS的盒 ...

  6. xadmin设置

    1.xadmin配置 INSTALLED_APPS = ( ... 'xadmin' , 'crispy_forms' , 'reversion' , ... ) 2.注册类 import xadmi ...

  7. 详细分析MySQL事务日志(redo log和undo log) 表明了为何mysql不会丢数据

    innodb事务日志包括redo log和undo log.redo log是重做日志,提供前滚操作,undo log是回滚日志,提供回滚操作. undo log不是redo log的逆向过程,其实它 ...

  8. nlp算法工程师养成记 目标要求

    时间规定: 2018.12.07-2018.02.15 能力养成: linux, shell python, c++(会多少算多少) tensorflow, keras, pytorch(tf优先) ...

  9. HDU-4725.TheShortestPathinNyaGraph(最短路 + 建图)

    本题思路:主要是建图比较麻烦,因为结点可以在层与层之间走动,也可以在边上进行走动,所以主要就是需要找到一个将结点和层统一化处理的方法. 所以我们就可以对于存在边的结点建边,层与层之间如果层数相差一也建 ...

  10. stark组件开发之添加按钮显示和URL

    添加: 需求: 根据用户的权限, 决定是否,有添加按钮.  通过配置进行定制,预留钩子进行权限的判断. class StartHandler(object): .................... ...