2015-09-26 161 views
3

我錯過了一些非常基本的東西。我有Jenkins 1.607,最近安裝了Template Project Plugin 1.5.1,但沒有看到創建模板的方法。這是我所看到的,當我選擇新的工作:基礎知識:如何在Jenkins中使用Template Project Plugin創建模板?

enter image description here

有工作流程模板上面,但沒有項目模板。我不知道我應該尋找...

網上搜索,我發現以下(http://mark.gg/2013/05/03/jenkins-and-templates/):

「要使用該模板插件,您可以創建一個作業,將有模塊 - 源代碼管理(SCM),構建者,發佈者 - 將被其他項目使用。「

但是,按照上面的說明,Jenkins創建了一個常規作業 - 我沒有看到指定模塊的方法。這裏是我的工作SCM節應該成爲一個模板:

Template job SCM section

新編輯:== >>我有一個定義的SCM部分幾項工作。下面是一個新創建的,自由泳的工作,我想使用SCM從已定義的工作,但目前還沒有這樣的選擇:

New job where I want to use SCM template

爲了記錄在案,這裏是安裝模板插件的快照:

Installed Template Plugins

欣賞就如何「創建工作,將有模塊」任何指針。

編輯:升級詹金斯到最新的1.631 - 同樣的問題。

回答

5

該模板項目是一個經典的詹金斯工作。 在此作業,請定義所有你想要克隆的作業使用模塊(SCM,建設,生成後,...):

enter image description here

enter image description here

enter image description here

下一頁,創建一個新工作並選擇模板模塊:

enter image description here

enter image description here

enter image description here

它是否解決問題了嗎?:)

+0

我有很多定義的作業。我剛剛創建了一個新的Freestyle項目,但我沒有看到使用SCM或其他任何其他模塊的選項。我將爲上面的原始問題添加快照。 – Lidia

+0

好消息是,我確實看到「使用來自其他項目的構建者/發佈者」來了解Bulid和後構建操作。感謝您指出這一點。任何想法爲什麼SCM模塊不可用? – Lidia

+0

沒有pb幫助:)關於SCM模塊,您是否在模板作業中定義了一些SCM設置? –

-2

Jenkins免費(社區)版本中不包含模板。相反,Cloudbees.com在其付費的「Jenkins for the Enterprise」產品和服務中提供了模板。

+0

你是說,即使我安裝了這個插件,它基本上沒有在社區版?爲什麼把它變成一個可用的插件呢?此外,https://wiki.jenkins-ci.org/display/JENKINS/Template+Project+Plugin上的說法僅限於企業版。 – Lidia

+2

您在付費版本中混淆了類似命名的功能。 – uchuugaka

2

我安裝了Jenkins 1.638,並使用來自已定義作業的SCM模板運行相同的問題,因爲它沒有顯示在選項列表中。在「Manage Jenkins」部分深入挖掘「系統日誌」可以獲得更多關於原因的信息。

Nov 13, 2015 3:22:53 PM INFO jenkins.InitReactorRunner$1 onAttained 
Augmented all extensions 

Nov 13, 2015 3:22:58 PM WARNING hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error 

Failed to instantiate Key[type=hudson.plugins.templateproject.ProxySCM$DescriptorImpl, annotation=[none]]; skipping this component 
com.google.inject.ProvisionException: Guice provision errors: 

1) Error injecting constructor, java.lang.NoClassDefFoundError: org/jenkinsci/plugins/multiplescms/MultiSCMRevisionState 
    at hudson.plugins.templateproject.ProxySCM$DescriptorImpl.<init>(ProxySCM.java:112) 

原因是插件「Multiple SCMs Plugin」存在依賴關係。安裝該插件並使用Template Project插件的版本1.5.1在Jenkins作業配置中正確顯示該選項。

SCM Options Before installing the Multiple SCM Plugin

SCM Options After installing the Multiple SCM Plugin

+0

插件([1](https: //issues.jenkins-ci.org/browse/JENKINS-31712)[2](https://issues.jenkins-ci.org/browse/JENKINS-30243))的插件似乎相關。 – Alex