当前位置:网站首页>Jenkins - built in variable access
Jenkins - built in variable access
2022-06-28 02:13:00 【wumingxiaoyao】
introduction
I have been puzzled by Jenkins An environment variable of CAUSE, Call... In the mail plug-in ${CAUSE} It is feasible. , But elsewhere ( perform Shell or Python Script time ), Really can only get None value . original Jenkins Built in variables are divided into two categories , A configuration variable that is only used for mail configuration , One is the global environment variable , Let's take a look at these variables .
Summary :
- Jenkins Built in variable view
- Jenkins Built in variable access
- Jenkins Built in mail configuration variables
- Jenkins Built in environment variables
Jenkins Built in variable view
- Jenkins URL + /env-vars.html/
for example : http://localhost:8080/env-vars.html/
- Jenkins URL + /pipeline-syntax/globals
for example : http://localhost:8080/pipeline-syntax/globals
Jenkins Built in variable access
List some common environment variables , Be careful CAUSE Variables are used for mail configuration , Used elsewhere is None value .
Jenkins Email configuration :
Just apply it ${CAUSE} Variable , The details of the email plug-in will be introduced next time .
Mail output :
Shell command
adopt ${Env_Variable_Name} or %{Env_Variable_Name}% visit
Shell Script :
echo "JENKINS_HOME: ${JENKINS_HOME}"
echo "JENKINS_URL: ${JENKINS_URL}"
echo "BUILD_URL: ${BUILD_URL}"
echo "BUILD_NUMBER: ${BUILD_NUMBER}"
echo "JOB_URL: ${JOB_URL}"
echo "JOB_NAME: ${JOB_NAME}"
echo "WORKSPACE: ${WORKSPACE}"
echo "CAUSE: ${CAUSE}"
Jenkins To configure :
Jenkins Output :
Python Script
import os
print("JENKINS_HOME: {} ".format(os.getenv('JENKINS_HOME')))
print("JENKINS_URL: {} ".format(os.getenv('JENKINS_URL')))
print("BUILD_URL: {} ".format(os.getenv('BUILD_URL')))
print("BUILD_NUMBER: {} ".format(os.getenv('BUILD_NUMBER')))
print("JOB_URL: {} ".format(os.getenv('JOB_URL')))
print("JOB_NAME: {} ".format(os.getenv('JOB_NAME')))
print("WORKSPACE: {} ".format(os.getenv('WORKSPACE')))
print("CAUSE: {} ".format(os.getenv('CAUSE')))
Jenkins To configure :
Jenkins Output :
Jenkins Built in mail configuration variables
| Variable | explain |
|---|---|
| ${GIT_BRANCH} | Git Branch |
| ${FILE,path=“xxx”} | xxx For the specified file , The contents of the file can be displayed in the mail . Be careful :xxx Is the relative path to the workspace directory , It's not an absolute path . |
| ${JOB_DESCRIPTION} | Show item description . |
| ${BUILD_NUMBER} | Displays the number of the current build . |
| ${SVN_REVISION} | Show svn Version number . And support Subversion Plug in exit SVN_REVISION_n edition . |
| ${CAUSE} | Show who 、 What channels trigger this build . |
| ${CHANGES } | Show changes since last build . |
| ${BUILD_ID} | Displays the generated by the current build ID. |
| ${PROJECT_NAME} | Displays the full name of the item . |
| ${PROJECT_DISPLAY_NAME} | Displays the display name of the item . |
| SCRIPT | Generate custom message content from a script . Custom scripts should be placed in “JENKINS_HOME/email-templates”. When using custom scripts, the default search is $JENKINS_HOME/email-templatesdirectory Catalog . Other directories will not be searched . |
| ${JENKINS_URL} | Show Jenkins Server's url Address ( It can be changed on the system configuration page ). |
| ${BUILD_LOG_MULTILINE_REGEX} | Match by regular expression and display the build log . |
| ${BUILD_LOG} | Show the final build log . |
| ${PROJECT_URL} | Displays the of the item URL Address . |
| ${BUILD_STATUS} | Displays the status of the current build ( Failure 、 Success, etc ). |
| ${BUILD_URL} | Displays the currently built URL Address . |
| ${CHANGES_SINCE_LAST_SUCCESS} | Show changes since the last successful build . |
| ${CHANGES_SINCE_LAST_UNSTABLE} | Show changes since the last unstable or successful build . |
| ${ENV} | Displays an environment variable . |
| ${FAILED_TESTS} | If there are failed tests , Show these failed unit test information . |
| ${PROJECT_URL} | Displays the of the item URL . |
| JELLYSCRIPT | From a Jelly Custom message content in script template . There are two templates to configure :HTML and TEXT. You can JENKINS_HOME/email-templates Replace it under custom . When using auto - semantic templates ,”template” The name of the parameter does not contain “.jelly”. |
| ${TEST_COUNTS} | Displays the number of tests . |
Jenkins Built in environment variables
| Variable | explain |
|---|---|
| BRANCH_NAME | For multi branch projects , This will be set to the name of the branch being built , for example , If you want to master Not from feature branch deployment to production . |
| CHANGE_ID | For a multi branch project corresponding to a change request , This will be set to change ID, For example, pull request number . |
| CHANGE_URL | For a multi branch project corresponding to a change request , This will be set to change URL. |
| CHANGE_TITLE | For a multi branch project corresponding to a change request , This will be set to change the title . |
| CHANGE_AUTHOR | For a multi branch project corresponding to a change request , This will be set to the user name of the author of the proposed change . |
| CHANGE_AUTHOR_DISPLAY_NAME | For a multi branch project corresponding to a change request , This will be set to the author's name . |
| CHANGE_AUTHOR_EMAIL | For a multi branch project corresponding to a change request , This will be set as the author's e-mail address . |
| CHANGE_TARGET | For a multi branch project corresponding to a change request , This will be set to the target or base branch where changes can be merged . |
| BUILD_NUMBER | The current number , Such as “153” |
| BUILD_ID | current version ID, And BUILD_NUMBER identical , Used in 1.597+ Zhongchuang Construction of building , But older versions YYYY-MM-DD_hh-mm-ss Time stamp |
| BUILD_DISPLAY_NAME | Display name of the current version , The default is “#153”. |
| JOB_NAME | The name of this build project , Such as “foo” or “foo / bar”. |
| JOB_BASE_NAME | The name of this build project will split the folder path , for example “bar / foo” Of “foo”. |
| BUILD_TAG | “jenkins- JOBNAME−{BUILD_NUMBER} ” String .JOB_NAME All forward slashes in (/) Will use dashes ( - ) Replace . Easy to put in resource files ,jar Documents, etc. , In order to identify . |
| EXECUTOR_NUMBER | Identify the current program executing this build ( In the execution program of the same computer ) The unique number of . This is you in “ Build performer status ” The numbers seen in , But the numbers start from 0 Start , instead of 1. |
| NODE_NAME | The name of the agent , If the build is a proxy , perhaps “ Lord ”, If running on the host |
| NODE_LABELS | Space delimited node assigned label list . |
| WORKSPACE | The absolute path assigned to the directory to build as the workspace . |
| JENKINS_HOME | Jenkins The absolute path of the directory allocated on the master node stores data . |
| JENKINS_URL | complete Jenkins website , for example http:// server:port / jenkins /( Be careful : Only when... Is set in the system configuration Jenkins URL) |
| BUILD_URL | The complete of this build URL, Such as http:// server:port / jenkins / job / foo / 15 /(Jenkins URL You have to set ) |
| JOB_URL | The complete of this job URL, Such as http:// server:port / jenkins / job / foo /( You have to set Jenkins URL) |
| SVN_REVISION | Subversion Version number , Currently checked out to the workspace , Such as “12345” |
| SVN_URL | Currently checked out to the workspace Subversion URL. |
边栏推荐
- 【sylixos】i2c设备驱动创建和使用
- Centos8 operation record command version Yum redis MySQL Nacos JDK
- [embedded foundation] memory (cache, ram, ROM, flash)
- Jenkins - Pipeline 语法
- 数据库的新选择 Amazon Aurora
- Take n multiple table names of a database as the values of a column in another table (the range can be a table in another database)
- Differences between cesium polygon extrudedheight and height
- [Yocto RM]8 - OpenEmbedded Kickstart (.wks) Reference
- Database query optimization: master-slave read-write separation and common problems
- 将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)
猜你喜欢

Jenkins - 邮件通知 Email Notification 插件

Chapitre 4: redis

Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)

Numpy----np.tile()函数解析

LMSOC:一种对社会敏感的预训练方法

Adding text labels to cesium polygons the problem of polygon center point offset is solved

Jenkins - Pipeline 语法
![[elt.zip] openharmony paper Club - memory compression for data intensive applications](/img/54/8248c1d95b04498d44a00ea94a6c85.png)
[elt.zip] openharmony paper Club - memory compression for data intensive applications

Neural network of zero basis multi map detailed map
随机推荐
混合app的介绍
嵌入式必学,硬件资源接口详解——基于ARM AM335X开发板 (上)
Drug interaction prediction based on learning size adaptive molecular substructure
JS random number (random number decimal)
LMSOC:一种对社会敏感的预训练方法
Self supervised learning and drug discovery
Review of drug discovery-02-prediction of molecular properties
PV操作原语
How to understand query, key and value in transformer
Jenkins - Groovy Postbuild 插件丰富 Build History 信息
Geojson format description (detailed format)
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
【ELT.ZIP】OpenHarmony啃论文俱乐部—数据密集型应用内存压缩
The practice of dual process guard and keeping alive in IM instant messaging development
【永艺XY椅】试用体验
如何高效读书学习
geojson 格式说明(格式详解)
[embedded foundation] memory (cache, ram, ROM, flash)
机器学习笔记 - 时间序列作为特征
Numpy----np.tile()函数解析