通过Jenkins Script 获取token,往postman 传递环境变量

本文档介绍了如何通过Jenkins Script获取token,并在执行Postman测试时将该token作为环境变量传递。参考了GitHub上的Feature Request和Stack Overflow上的解决方案,需要注意的是,此脚本不能在Jenkins Sandbox环境中运行,需使用Jenkins Script方式执行。
摘要由CSDN通过智能技术生成

参考:​​​​​​Feature Request: read variables from OS environment · Issue #1603 · postmanlabs/postman-app-support · GitHub

maven - Jenkins CI Pipeline Scripts not permitted to use method groovy.lang.GroovyObject - Stack Overflow

1. 通过Jenkins Script 获取token

2. 在启动时将环境变量传递给postman test

#!groovy

timeout(time: 2, unit: 'HOURS') {
    podTemplate(label: label,
    	containers:
    	[
        		containerTemplate(name: 'newman', image: '*****/cibuildslave/newman_html:newman_html_cms', privileged: false, command: 'cat', ttyEnabled: true, alwaysPullImage: true),
                containerTemplate(name: 'python', image: '******/cibuildslave/python-http:python-http', privileged: false, command: 'cat', ttyEnabled: true, alwaysPullImage: true)
        ],
        volumes: [emptyDirVolume(mountPath: '/home/jenkins', memory: true)],
        imagePullSecrets: [
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值