bmoers / sn-cicd-integration

Server Component for CICD
https://github.com/bmoers/sn-cicd/tree/release/4
8 stars 37 forks source link

Deploy update set failed, CD user related #5

Closed gitlabbin closed 5 years ago

gitlabbin commented 5 years ago

What kind of role should CD user have, already give user 'admin' role: But got the error, any other role should the CD user have?

[ERROR] [5120]   [/worker#iOhcvYPH1T4d0h9qAAAB] PROMISE JOB ERROR: Job 'deployUpdateSet' { type: 'exe',
  name: 'deployUpdateSet',
  options: { commitId: 'f1b4973c32d8a717375c78a238cac930d7d2dbbe' },
  host: 'svcm27033c79np.dummy.aws.local',
  id: 'cff05f2c-e1f5-489d-91eb-1dd21db7aed0',
  emitter: { _events: {}, _eventsCount: 2 },
  created: 1551139554076,
  completed: null,
  workerId: '/worker#iOhcvYPH1T4d0h9qAAAB',
  result: undefined,
  error: undefined } { error:
   { message:
      'https://[xxxxxxxxxx].service-now.com//api/devops/v1/cicd/pull Request ended in error. Code: 666, Message: Method failed: (//api/devops/v1/cicd/pull) with codetail":"Somethings wrong with the creation of sys_update_set_source. CD User must have admin grants.","message":"Source Creation Failed"},"status":"failure"}',
     detail: '' },
  status: 'failure' }

Did read the code, reach the failed point, user already have admin role.

Any clue for that?

gitlabbin commented 5 years ago

error logs in service now target box: Looks like the Business Rule abort the api /api/devops/v1/cicd/pull call

Operation against file 'sys_update_set_source' was aborted by Business Rule 'Validate Connection^1d7981a6dbbb6b4421972db61496196d'. Business Rule Stack:Validate Connection


20:17:21.773 | Info | API_INT-thread-2 | 1D7905EEDB7B6B4421972DB61496194B | txid=157905eedb7b Background message, type:error, message: A remote instance with the same instance id already exists.
-- | -- | -- | -- | --
20:17:21.773 | Info | API_INT-thread-2 | 1D7905EEDB7B6B4421972DB61496194B | txid=157905eedb7b Operation against file 'sys_update_set_source' was aborted by Business Rule 'Validate Connection^1d7981a6dbbb6b4421972db61496196d'. Business Rule Stack:Validate Connection
20:17:21.773 | Info | API_INT-thread-2 | 1D7905EEDB7B6B4421972DB61496194B | txid=157905eedb7b Slow business rule 'Validate Connection' on sys_update_set_source:7a228ade330c9d94249617d7017f7ca0, time was: 0:00:00.237
20:17:21.789 | Info | API_INT-thread-2 | 1D7905EEDB7B6B4421972DB61496194B | txid=157905eedb7b #24499729 [REST API] RESTAPIProcessor : Source Creation Failed
20:17:21.789 | Info | API_INT-thread-2 | 1D7905EEDB7B6B4421972DB61496194B | txid=157905eedb7b *** End #24499729 /api/devops/v1/cicd/pull, user: svc_cicd, total time: 0:00:00.282, processing time: 0:00:00.282, SQL time: 0:00:00.027 (count: 29), business rule: 0:00:00.237 (count: 1), ACL time: 0:00:00.001, Cache build time: 0:00:00.001 , type:rest, method:POST, api_name:devops/cicd, resource:devops/v1/cicd/pull, version:v1, user_id:ae51b9c2dbdbeb8421e95d87f49619e1, response_status:666
bmoers commented 5 years ago

admin is sufficient :-)

guess the host 'https://dummytest.service-now.com/' does not exist. (this is taken from the initial run request on an update set.)

gitlabbin commented 5 years ago

That's not real log file, I replaced some sensitive server information.

Saw some docs mention "Business Rule " validateConnection https://community.servicenow.com/community?id=community_blog&sys_id=20dc2665dbd0dbc01dcaf3231f9619ed

If you were to bypass the validation you would have to also modify or temporarily disable the business rule "Validate Connection" that refers to GlideUpdateSetWorker on the sys_update_set_source table. There is very little documentation on GlideUpdateSetWorker.
bmoers commented 5 years ago

pls on target env. comment 'source.deleteRecord();' on line https://github.com/bmoers/sn-cicd-integration/blob/master/script_include/CiCdDeploy.js#L318 and run again. It then will not remove the source definition on the target on failure.

My guess is that its using the non admin CI user in the source definition to connect. Pleas let me know.

Anyway, the deployment part is somehow not transparent enough. I'm currently working on this as mentioned in https://github.com/bmoers/sn-cicd/issues/5.

gitlabbin commented 5 years ago

thanks for your reply, will try it out.