microsoft / azure-pipelines-extensions

Collection of all RM and deployment extensions

Home Page:http://www.visualstudio.com/explore/release-management-vs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service Now extension fails to update change in case of rerunning failed jobs

vidarkongsli opened this issue · comments

I have set up the Service Now integration to run in a YAML pipeline where I update the change request upon completion of the stage. The change request is created by the ServiceNow Change management check on the environment. It works fine in the case that all the jobs in the stage run successfully.

But if I need to re-run failed jobs in the stage, it seems that it loses the stage id, and creates a new service now change instead of updating the existing one.

In the logs, I can observe that the GET request fired to get the change request number differs between the attempts.

First attempt:

GET https://<redacted>.service-now.com//api/now/table/change_request?sysparm_query=x_mioms_azpipeline_stage_id=c2f23cc9-b49b-5971-bdfa-5e6430153f6c^x_mioms_azpipeline_build_id=135294^x_mioms_azpipeline_stage_attempt=1&sysparm_fields=number,correlation_id
				Response Code: OK
				Response: {
  "result": [
    {
      "number": "CHG0033296",
      "correlation_id": "97670cb0-aae1-491b-89d7-431693f3ab7e"
    }
  ]
}

Then, on a later attempt:

GET https://<redacted>.service-now.com//api/now/table/change_request?sysparm_query=x_mioms_azpipeline_stage_id=9039092a-9198-5115-026a-7747c2953b49^x_mioms_azpipeline_build_id=135294^x_mioms_azpipeline_stage_attempt=3&sysparm_fields=number,correlation_id
				Response Code: OK
				Response: {
  "result": [
    {
      "number": "CHG0033298",
      "correlation_id": "f68627fc-fd2e-4cdb-9772-cc31fc74843a"
    }
  ]
}

Observe that:

  • x_mioms_azpipeline_stage_id: the value is changed
  • x_mioms_azpipeline_stage_attempt: the value is changed from 1 to 3
  • x_mioms_azpipeline_build_id: the value is unchanged
  • the returned number value differs between the attempts.

I would expect the x_mioms_azpipeline_stage_id value to stay the same. What could be the cause of this?

Version information:

  • Update change request in ServiceNow task version: 2.183.0
  • ServiceNow Change Management extension version: 4.215.1 (last updated: jan 17, 2023)