当前位置:网站首页>DevOps集成-Jenkins 服务的环境变量和构建工具 Tools
DevOps集成-Jenkins 服务的环境变量和构建工具 Tools
2022-04-23 19:23:00 【隔壁老瓦】
一、环境变量
环境变量可以被看作是pipeline与Jenkins交互的媒介。比如,可以在 pipeline 中通过 BUILD_NUMBER 变量知道构建任务的当前构建次数。环境变量可以分为Jenkins内置变量和自定义变量。
1.1、Jenkins 内置变量
在pipeline执行时,Jenkins通过一个名为 env 的全局变量,将Jenkins内置环境变量暴露出来。
默认env的属性可以直接在 pipeline 中引用;有三种引用方式:
- ${env.BUILD_NUMBER} 方式一,推荐使用
- $env.BUILD_NUMBER 方式二,
- ${BUILD_NUMBER} 方式三,不推荐使用
下面我们简单介绍几个在实际工作中经常用到的变量。
- BUILD_NUMBER:构建号,累加的数字。
- BRANCH_NAME:多分支pipeline项目支持。
- BUILD_URL:当前构建的页面URL。
- GIT_BRANCH:通过git拉取的源码构建的项目才会有此变量。
1.2、自定义 Pipeline 环境变量
当pipeline变得复杂时,我们就会有定义自己的环境变量的需求。声明式pipeline提供了environment 指令,方便自定义变量。
另外,environment 指令可以在pipeline中定义,代表变量作用域为整个 pipeline;也可以在 stage 中定义,代表变量只在该阶段有效。
如果在environment中定义的变量与env中的变量重名,那么被重名的变量的值会被覆盖掉。
1.3、自定义全局环境变量
有时候,我们需要定义一些全局的跨pipeline的自定义变量。<
版权声明
本文为[隔壁老瓦]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wxb880114/article/details/124309081
边栏推荐
- [record] typeerror: this getOptions is not a function
- Redis optimization series (III) solve common problems after master-slave configuration
- 点云数据集常用处理
- Openlayers 5.0 reload the map when the map container size changes
- JVM的类加载过程
- Data analysis learning directory
- Translation of audio signal processing and coding: Preface
- FTP, SSH Remote Access and control
- [transfer] summary of new features of js-es6 (one picture)
- How to use go code to compile Pb generated by proto file with protoc Compiler Go file
猜你喜欢

The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch

5 minutes to achieve wechat cloud applet payment function (including source code)

Class loading process of JVM

Oracle配置st_geometry
![[报告] Microsoft :Application of deep learning methods in speech enhancement](/img/29/2d2addd826359fdb0920e06ebedd29.png)
[报告] Microsoft :Application of deep learning methods in speech enhancement

Openharmony open source developer growth plan, looking for new open source forces that change the world!
![[报告] Microsoft :Application of deep learning methods in speech enhancement](/img/c1/7bffbcecababf8dabf86bd34ab1809.png)
[报告] Microsoft :Application of deep learning methods in speech enhancement

Garbage collector and memory allocation strategy

Application of DCT transform

开关电源设计分享及电源设计技巧图解
随机推荐
Wechat applet part of the mobile phone Preview PDF did not respond
ArcGIS JS API dojoconfig configuration
openlayers draw矩形
All table queries and comment description queries of SQL Server
HTTP cache - HTTP authoritative guide Chapter VII
Convert string to JSON
Why is PostgreSQL about to surpass SQL Server?
JS controls the file type and size when uploading files
redis优化系列(三)解决主从配置后的常见问题
Audio signal processing and coding - 2.5.3 the discrete cosine transform
ArcMap连接 arcgis server
开关电源设计分享及电源设计技巧图解
Customize the non slidable viewpage and how to use it
2021-2022-2 ACM training team weekly Programming Competition (8) problem solution
【玩转Lighthouse】腾讯云轻量服务器搭建全平台视频解析视频下载网站
8266 obtain 18b20 temperature
数据分析学习目录
Openlayers 5.0 loading ArcGIS Server slice service
SSDB Foundation
Virtual machine performance monitoring and fault handling tools