当前位置:网站首页>Jenkins - access the Jenkins user-defined parameter variable, and handle the variable value containing spaces
Jenkins - access the Jenkins user-defined parameter variable, and handle the variable value containing spaces
2022-06-28 02:12:00 【wumingxiaoyao】
introduction
Jenkins job Some variables will be customized in , These variables will be accessed by different plug-ins . I encountered a pit in my work , Is when the variable value contains spaces , When a variable is called as a parameter Python Function time , The content after the space will be truncated , This article will solve this problem .
Summary :
- Defining variables
- Execute Python script Plug in access variables
- Execute shell Plug in access variables
Defining variables
Jenkins job Pass through Add Parameter A variable is defined String Variable of type Project_Name, The default value is... With spaces .
Execute Python script Plug in access variables
perform Python Script , adopt os.getenv(‘Project_Name’) Access variables , The printed value is Project XXX
Execute shell Plug in access variables
perform Shell command , Can pass ${Project_Name} or %{Project_Name}% Access variables
adopt echo The variable value output by the command is normal Project XXX
But called as a parameter python Script , There will be unexpected results . Pass in $ {Project_Name } As a parameter , A variable's value is Project, The content after the space is truncated .
In order to get the complete variable value , Need to add " ", " ${Project_Name} " The obtained value is complete Project XXX
边栏推荐
- 嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)
- Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
- 评价——灰色关联分析
- TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
- 【sylixos】i2c设备驱动创建和使用
- Drug interaction prediction based on learning size adaptive molecular substructure
- What are the risks of opening a compass stock account? Is it safe to open a compass account
- Original | 2025 to achieve the "five ones" goal! The four products of Jiefang power are officially released
- Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data
猜你喜欢

【永艺XY椅】试用体验

Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)

Review of drug discovery-03-molecular design and optimization

How to optimize the "message" list of IM

Machine learning notes - time series as features

评价——秩和比综合评价

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

【嵌入式基础】串口通信

Cesium obtains the latitude and longitude range of the screen

frp实现内网穿透
随机推荐
How to understand query, key and value in transformer
声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
Description du format geojson (détails du format)
Prometeus 2.35.0 新特性
Adding text labels to cesium polygons the problem of polygon center point offset is solved
Fundamentals of scala (3): operators and process control
评价——秩和比综合评价
JS 数组随机取值(随机数组取值)
How fiddle uses agents
Cesium Color 颜色(赋值)随机颜色
自监督学习与药物发现
Machine learning notes - time series as features
ionic4实现半星评分
深入解析kubernetes controller-runtime
Jenkins - 邮件通知 Email Notification 插件
数据库查询优化:主从读写分离及常见问题
Xctf attack and defense world misc wage earner advanced zone
Intranet penetration with FRP
fiddle如何使用代理
The interviewer asked: this point of JS