繁体   English   中英

在构建中将 Jenkins 参数传递给 python 脚本

[英]Pass Jenkins Parameter to python script in a Build

我有一个带有参数“github_username”的 jenkins 作业,该作业正在通过下面的行传递给 python 脚本。我使用了一个字符串参数,但脚本是针对用户名的每个字母运行的,而不是针对用户名作为一个单词运行。 有更好的吗?

users = os.environ.get("github_username")
import os
## Reading all members from file 
## with open('users.txt') as file:
##    users = file.read().splitlines()
## users = os.environ.get('github_username')

users = os.environ['github_username']

在此处输入图像描述

尝试这个:

import os
users = os.environ['github_username']

在你的管道中,使用这样的东西:

sh "python3 my-little-python3.py"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM