如何从结帐中获取 svn 版本号以在 dsl 中使用 [英] How to get svn version number from checkout for use in dsl

查看:14
本文介绍了如何从结帐中获取 svn 版本号以在 dsl 中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个管道作业,并希望获得 svn 版本号,以便在调用 shell 脚本时启用进一步的下游处理.我正在使用类似于以下的管道脚本:

I created a pipeline job and would like to get the svn version number to enable further downstream processing in a call to a shell script. I am using a pipeline script similar to the following:

node {
   // Mark the code checkout 'stage'....
   stage 'Checkout'

   // Get some code from a SVM repository
   checkout(
       [
           $class: 'SubversionSCM', 
           additionalCredentials: [], 
           excludedCommitMessages: '', 
           excludedRegions: '', 
           excludedRevprop: '', 
           excludedUsers: '', 
           filterChangelog: false, 
           ignoreDirPropChanges: false, 
           includedRegions: '', 
           locations: [
               [
                   ...
                ]
            ], 
            workspaceUpdater: [$class: 'UpdateUpdater']
        ]
    )
    def svnversionnumber=${SVN_VERSION}



   sh "/.../someshellscript ${svnversionnumber};"
}

是否有关于结帐功能的文档?是否有可能获得 svn 修订号?可以看到修改输出到日志了.

Is there documentation on the checkout function available? Is it possible to get hold of the svn revision number? I can see that the revision is output to the log.

推荐答案

我也遇到了同样的问题,但是你可以通过调用 SCM checkout.它包含 SVN_REVISION 的值.

I had the same issue, but you can solve it by using the map that is returned from calling SCM checkout. It contains a value for SVN_REVISION.

// Get some code from a SVM repository
def scmVars = checkout(
  ...
)

def svnversionnumber = scmVars.SVN_REVISION

这篇关于如何从结帐中获取 svn 版本号以在 dsl 中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆