我有一個創建Jenkins作業的種子作業,而作業創建時,他們缺少SCM,標籤和包裝等東西。Jenkins作業dsl生成的作業缺失SCM
下面是被創建一個簡單的作業腳本:
job(jobName) {
label('pdfs')
description jobDesc
parameters {
textParam('PDF_BRANCH', 'release/server_2.11.1', '')
}
scm {
git {
remote {
url('https://stash.domain.com/scm/project/repo.git')
credentials('repo-user-creds')
}
branch('*/master')
}
}
triggers {
scm 'H/5 * * * *'
}
steps {
shell jobScript
}
wrappers {
rbenv('1.9.3-p484') {
ignoreLocalVersion()
gems('bundler', 'rake')
}
}
}
但由此產生的工作沒有SCM或標籤: 服務器上的XML似乎包括SCM和標籤:
<?xml version="1.0" encoding="UTF-8"?><project>
<actions/>
<description>Testing pdf creation job against Elemental Server</description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.TextParameterDefinition>
<name>PDF_BRANCH</name>
<defaultValue>release/server_2.11.1</defaultValue>
<description/>
</hudson.model.TextParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<hudson.triggers.SCMTrigger>
<spec>H/5 * * * *</spec>
<ignorePostCommitHooks>false</ignorePostCommitHooks>
</hudson.triggers.SCMTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>
# REMOVED FOR BREVITY
</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers>
<ruby-proxy-object>
<ruby-object ruby-class="Jenkins::Tasks::BuildWrapperProxy" pluginid="rbenv">
<pluginid ruby-class="String" pluginid="rbenv">rbenv</pluginid>
<object ruby-class="RbenvWrapper" pluginid="rbenv">
<version ruby-class="String" pluginid="rbenv">1.9.3-p484</version>
<ignore__local__version ruby-class="String" pluginid="rbenv">true</ignore__local__version>
<gem__list ruby-class="String" pluginid="rbenv">bundler,rake</gem__list>
<rbenv__root ruby-class="String" pluginid="rbenv">$HOME/.rbenv</rbenv__root>
<rbenv__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/rbenv.git</rbenv__repository>
<rbenv__revision ruby-class="String" pluginid="rbenv">master</rbenv__revision>
<ruby__build__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
<ruby__build__revision ruby-class="String" pluginid="rbenv">master</ruby__build__revision>
</object>
</ruby-object>
</ruby-proxy-object>
</buildWrappers>
<assignedNode>pdfs</assignedNode>
<scm class="hudson.plugins.git.GitSCM">
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://stash.domain.com/scm/project/repo.git</url>
<credentialsId>repo-user-creds</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<configVersion>2</configVersion>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<gitTool>Default</gitTool>
</scm>
我對詹金斯job-dsl非常陌生,所以我確信我錯過了一些相當明顯的東西,但我只是不知道它是什麼。非常感謝任何幫助,謝謝!
所以你有git插件安裝? – KeepCalmAndCarryOn
是的,我可以手動添加一個SCM來源,選擇憑證等,它會工作。 – Resisty