Jenkinsfile Python参数

0kjbasz6  于 2022-11-02  发布在  Jenkins
关注(0)|答案(1)|浏览(216)

我得到了一个python脚本,运行方式类似python3 test.py arg1 arg2
我设置了一个jenkins任务,并使用2个字符串参数对其进行了参数化
我如何设置我的Jenkinsfile?这是我现在拥有的全部

  1. pipeline {
  2. agent any
  3. stages {
  4. stage('version') {
  5. steps {
  6. sh 'python3 --version'
  7. }
  8. }
  9. stage('hello') {
  10. steps {
  11. sh 'python3 temp.py'
  12. }
  13. }
  14. }
  15. }
wfauudbj

wfauudbj1#

您是否在寻找以下产品?

  1. pipeline {
  2. agent any
  3. parameters {
  4. string(name: 'param1', defaultValue: 'test', description: '')
  5. string(name: 'param2', defaultValue: 'test2', description: '')
  6. }
  7. stages {
  8. stage('version') {
  9. steps {
  10. sh 'python3 --version'
  11. }
  12. }
  13. stage('hello') {
  14. steps {
  15. sh "python3 temp.py ${params.param1} ${params.param2}"
  16. }
  17. }
  18. }
  19. }
展开查看全部

相关问题