Search code examples
command-line-tooludeploy

IBM uDeploy client import request problem


I have had a PowerShell scripted call to the IBM uDeploy command line client (udclient) in my TFS CI build process for some time now.

My udclient call is scripted like so:

udclient.cmd -weburl $uDeployServer -authtoken $authToken "importVersions" $requestJson

... and my JSON file ($requestJson) content looks like this:

{
  "component": "[uDeploy component name]",
  "properties": {
    "version": "[component version]"
  }
}

These requests, and subsequent udclient version deploy requests, have been working as expected until recently. However, a couple of weeks ago, the version import requests started to fail mysteriously.

In the uDeploy UI, in the Version Import History tab in the Component Configuration, I can see the failed Import Requests.

However, when I open the Output Log for inspection, it is empty. The Error Log contains only this:

"The version import failed for the following reasons: JSONObject["value"] not found."

Manual version import from the uDeploy UI still works as expected.

Also, once manual intervention has been applied to complete the version import in the CI build, the subsequent version deploy request executes without any problems.

I'm not expert in Java but the error seemed to me to suggest something was amiss with the JSON file. However, to test my JSON (I'm using PS 5, no Test-Json until PS 6), execution of the following PowerShell script:

try {
    $json = Get-Content -Path [component version import].json | ConvertFrom-Json
    Write-Host "JSON is valid."
} catch {
    Write-Host "JSON is dodgy."
}

... returns:

JSON is valid.

So, what's going on? Could it be something to do with encoding in the JSON file or some such?? Ideas and insights appreciated; thanks for looking.


Solution

  • I scripted the REST API call for native PowerShell:

    Invoke-RestMethod -Uri $uDeployServer/cli/component/integrate" -Method Put -Headers $headers -ContentType "application/json" -Body $json
    

    The request was sent without issue but sadly, as with the udclient call, the same error persisted.

    Looking at the failed version import request record in the uDeploy UI, aside from the vague message in the error log, the request Input Properties showed two properties only (successful requests show many properties from the component configuration):

    • version (value correctly read from the JSON file provided)
    • description (value blank)

    I added a new property 'description' to my request JSON; the file content now looks like this:

    {
      "component":"[uDeploy component name]",
      "properties":{
        "version":"[component version]",
        "description":"[description]"
      }
    }
    

    Hey Presto! Version Import request executes successfully.