栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在詹金斯中,ws()块有什么作用?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在詹金斯中,ws()块有什么作用?

ws
分配一个新的工作区。您将使用它来确保其他任何因素都不会干扰磁盘上运行所附步骤的位置。

  • 这不会像
    node
    步骤那样繁重,因为
    node
    这还将确保它由单独的执行程序运行。
  • 这将提供比
    dir
    步骤更多的隔离,因为这
    dir
    将无法确保在文件系统上的隔离位置
    ws

您可以按照与脚本相同的方式在声明性管道中使用它:

pipeline {  agent { label 'docker' }  stages {    stage('hot_stage') {      steps {        sh 'pwd'        ws('/tmp/hey') {          sh 'pwd'        }      }    }  }}

产生输出:

+ pwd/opt/jenkins/workspace/tool_jenkins2-test_master-R4LIKJR63O6POQ3PHZRAKWWWGZZEQIVXVDTM2ZWZEBAWE3XKO6CQ[Pipeline] wsRunning in /tmp/hey[Pipeline] {[Pipeline] sh[hey] Running shell script+ pwd/tmp/hey

参考资料:

  • https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#pre-ws-pre-allocate-workspace
  • https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#allocating-workspaces


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/608922.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号