Submitting a job via REST fails to save SCM and polling settings

18 views
Skip to first unread message

imbacen

unread,
Apr 28, 2016, 6:10:59 PM4/28/16
to Jenkins Users
I submitted a new job via GUI and then replicated the exact same JSON
with a REST call. The result is not the same unfortunately, the new job
is missing SCM and polling information but has slave label and build
command stored successfully.

I am calling Jenkins with basic authentication and www-urlencoded form
data with json in a field "json". I am guessing that scm and polling are
not being saved via json and I need to include the full form data aswell?

Best regards, cen

JSON recorded from GUI http request:
{
	blockBuildWhenDownstreamBuilding:false,
	blockBuildWhenUpstreamBuilding:false,
	builder:{
		'':'ls',
		$class:'hudson.tasks.Shell',
		command:'ls',
		'stapler-class':'hudson.tasks.Shell'
	},
	concurrentBuild:false,
	'core:apply':'',
	customWorkspace:'',
	description:'',
	disable:false,
	displayNameOrNull:'',
	hasCustomQuietPeriod:false,
	hasCustomScmCheckoutRetryCount:false,
	hasCustomWorkspace:false,
	hasSlaveAffinity:true,
	'hudson-triggers-SCMTrigger':{
		ignorePostCommitHooks:false,
		scmpoll_spec:'*****'
	},
	label:'cb79c0f4d8afad287c0cfc982681f1f3',
	name:'comon',
	properties:{
		'com-coravy-hudson-plugins-github-GithubProjectProperty':{},
		'hudson-model-ParametersDefinitionProperty':{
			specified:false
		},
		'jenkins-branch-RateLimitBranchProperty$JobPropertyImpl':{},
		'jenkins-model-BuildDiscarderProperty':{
			'':'0',
			specified:false,
			strategy:{
				$class:'hudson.tasks.LogRotator',
				artifactDaysToKeepStr:'',
				artifactNumToKeepStr:'',
				daysToKeepStr:'',
				numToKeepStr:'',
				'stapler-class':'hudson.tasks.LogRotator'
			}
		},
		'stapler-class-bag':'true'
	},
	quiet_period:'5',
	scm:{
		'':'auto',
		branches:{
			name:'*/master'
		},
		userRemoteConfigs:{
			credentialsId:'',
			name:'',
			refspec:'',
			url:'https://github.com/cen1/helloworld.git'
		},
		value:'1'
	},
	scmCheckoutRetryCount:'0'
}


My replicated JSON sent by rest client:
{
	blockBuildWhenDownstreamBuilding:false,
	blockBuildWhenUpstreamBuilding:false,
	builder:{
		'':'ls',
		$class:'hudson.tasks.Shell',
		command:'ls',
		'stapler-class':'hudson.tasks.Shell'
	},
	concurrentBuild:false,
	'core:apply':'',
	customWorkspace:'',
	description:'',
	disable:false,
	displayNameOrNull:'',
	hasCustomQuietPeriod:false,
	hasCustomScmCheckoutRetryCount:false,
	hasCustomWorkspace:false,
	hasSlaveAffinity:true,
	'hudson-triggers-SCMTrigger':{
		ignorePostCommitHooks:false,
		scmpoll_spec:'*****'
	},
	label:'c177fc6a48acb6d709580ad08da45f68',
	name:'8ab5040f-8e18-4588-9245-1a2bdee3a6fe',
	properties:{
		'com-coravy-hudson-plugins-github-GithubProjectProperty':{},
		'hudson-model-ParametersDefinitionProperty':{
			specified:false
		},
		'jenkins-branch-RateLimitBranchProperty$JobPropertyImpl':{},
		'jenkins-model-BuildDiscarderProperty':{
			'':'0',
			specified:false,
			strategy:{
				$class:'hudson.tasks.LogRotator',
				artifactDaysToKeepStr:'',
				artifactNumToKeepStr:'',
				daysToKeepStr:'',
				numToKeepStr:'',
				'stapler-class':'hudson.tasks.LogRotator'
			}
		},
		'stapler-class-bag':'true'
	},
	quiet_period:'5',
	scm:{
		'':'auto',
		branches:{
			name:'*/master'
		},
		userRemoteConfigs:{
			credentialsId:'',
			name:'',
			refspec:'',
			url:'https://github.com/cen1/helloworld.git'
		},
		value:'1'
	},
	scmCheckoutRetryCount:'0'
}


The 'hudson-triggers-SCMTrigger' and 'scm' properties are not being
saved by Jenkins.

Reply all
Reply to author
Forward
0 new messages