美文网首页
Jenkins Pipeline: read a file an

Jenkins Pipeline: read a file an

作者: _fishman | 来源:发表于2020-07-23 17:49 被阅读0次
pipeline {
  agent { label 'master' }
  stages {
      stage('write') {
          steps {
              script {
                  def date = new Date()
                  def data = "Hello World\nSecond line\n" + date
                  writeFile(file: 'zorg.txt', text: data)
                  sh "ls -l"
              }
          }
      }
      stage('read') {
          steps {
              script {
                  def data = readFile(file: 'zorg.txt')
                  println(data)
              }
          }
      }
  }
}

https://code-maven.com/jenkins-readfile-writefile

相关文章

网友评论

      本文标题:Jenkins Pipeline: read a file an

      本文链接:https://www.haomeiwen.com/subject/juwhlktx.html