![](/img/trans.png)
[英]How can I use the Team Foundation Server SCM plugin with a Jenkins Pipeline groovy script?
[英]How to use RTC plugin from jenkins pipeline groovy script?
我知道我可以通過 Jenkins RTC 插件使用 scm 輪詢,我只是想知道是否有一個示例說明如何通過管道插件的 groovy 腳本執行此操作?
例如:
node{
stage 'Checkout'
git url: 'https://github.com/whatever/myrepo.git'
...
}
類似上面的東西,但不是 git,而是使用帶有 prod url 的 rtc 工具包並指定流或工作區......在任何地方都找不到示例,並且不確定如何通過 api 實現它(或者如果這可能?)
實際上,代碼段生成器有點誤導,因為它不會生成您需要的所有內容。 例如,根據生成的內容,我在管道中使用了它:
node {
teamconcert([buildDefinition: 'TestStream', value: 'buildDefinition'])
}
如果你按原樣使用它,你會得到這個例外:
RTC : checkout...
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
at com.ibm.team.build.internal.hjplugin.RTCScm.checkout(RTCScm.java:1948)
atorg.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
at hudson.security.ACL.impersonate(ACL.java:221)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
您需要的語法是這樣的:
node {
teamconcert([
buildType: [
buildDefinition: 'TestStream',
value: 'buildDefinition'
]
])
}
團隊音樂會期望將事物包裝在“buildType”中。 我在 jazz.net 上的論壇回答中找到了這個,在其他任何地方都沒有看到它的記錄。
管道插件中有一個片段代碼生成器,我花了一段時間才找到它,但它會為任何 Jenkins 任務生成常規代碼... Rtc 列在 teamconcert: Team Concert 下,只需向下滾動到底部並勾選代碼段生成器復選框!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.