日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jenkins内置变量的使用

發布時間:2025/7/14 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jenkins内置变量的使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考鏈接: ?https://www.cnblogs.com/puresoul/p/4828913.html

一、查看Jenkins有哪些環境變量

1、新建任意一個job

2、增加構建步驟:Execute shell 或 Execute Windows batch command

3、點擊輸入框下方的“可用環境變量”

?

4、可以看到有如下變量供使用:?

變量名解釋
BUILD_NUMBERThe current build number, such as "153"
BUILD_IDThe 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_NAMEThe display name of the current build, which is something like "#153" by default.
JOB_NAMEName 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_TAGString of "jenkins-${JOB_NAME}-${BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_NUMBERThe 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_NAMEName of the slave if the build is on a slave, or "master" if run on master
NODE_LABELSWhitespace-separated list of labels that the node is assigned.
WORKSPACEThe absolute path of the directory assigned to the build as a workspace.
JENKINS_HOMEThe absolute path of the directory assigned on the master node for Jenkins to store data.
JENKINS_URLFull URL of Jenkins, like http://server:port/jenkins/ (note: only available if Jenkins URL set in system configuration)
BUILD_URLFull URL of this build, like http://server:port/jenkins/job/foo/15/ (Jenkins URL must be set)
SVN_REVISIONSubversion revision number that's currently checked out to the workspace, such as "12345"
SVN_URLSubversion URL that's currently checked out to the workspace.
JOB_URLFull 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>

?

轉載于:https://www.cnblogs.com/xyao1/p/10971284.html

總結

以上是生活随笔為你收集整理的jenkins内置变量的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。