How to set PATH in Jenkins Declarative Pipeline

后端 未结 4 836
面向向阳花
面向向阳花 2021-01-01 08:55

In Jenkins scripted pipeline you can set PATH env variable like this :

node {
   git url: \'https://github.com/jglick/simple-maven-project-with-tests.git\'
          


        
4条回答
  •  情书的邮戳
    2021-01-01 09:22

    It is possible with environment section:

    pipeline {
      agent { label 'docker' }
      environment {
        PATH = "/hot/new/bin:$PATH"
      }
      stages {
        stage ('build') {
          steps {
            echo "PATH is: $PATH"
          }
        }
      }
    }
    

    See this answer for info.

提交回复
热议问题