buildasaurs / XcodeServerSDK

Access Xcode Server API with native Swift objects.
MIT License
399 stars 30 forks source link

Has API changed with latest OS X Server update? #126

Closed kdawgwilk closed 8 years ago

kdawgwilk commented 8 years ago

My response from the Integrations call:

{
  "_id": "d527eca6aaac9f039f79924d5400cfc2",
  "_rev": "44-93d5778374ffb65e962d770846efcef7",
  "group": {
    "name": "3BC15988-9F4E-44B4-AD6C-840F9287E2A7"
  },
  "configuration": {
    "builtFromClean": 2,
    "periodicScheduleInterval": 0,
    "codeCoveragePreference": 1,
    "performsTestAction": true,
    "triggers": [
      {
        "phase": 1,
        "scriptBody": "export PATH=\"/Users/kwilkinson/.rvm/rubies/ruby-2.2.1/bin:$PATH\"\nexport LANG=en_US.UTF-8\n\ncd Billboard\npod install",
        "type": 1,
        "name": "Run Script"
      }
    ],
    "performsAnalyzeAction": true,
    "schemeName": "Billboard",
    "exportsProductFromArchive": true,
    "testingDeviceIDs": [],
    "deviceSpecification": {
      "filters": [
        {
          "platform": {
            "_id": "d527eca6aaac9f039f79924d540030fc",
            "displayName": "tvOS",
            "_rev": "3-669f3d35f0e9d9c6f521bf7d85e44a33",
            "simulatorIdentifier": "com.apple.platform.appletvsimulator",
            "identifier": "com.apple.platform.appletvos",
            "buildNumber": "13T393",
            "version": "9.0"
          },
          "filterType": 0,
          "architectureType": 0
        }
      ],
      "deviceIdentifiers": []
    },
    "weeklyScheduleDay": 0,
    "minutesAfterHourToIntegrate": 0,
    "scheduleType": 2,
    "hourOfIntegration": 0,
    "performsArchiveAction": false,
    "testingDestinationType": 0,
    "sourceControlBlueprint": {
      "DVTSourceControlWorkspaceBlueprintLocationsKey": {
        "F04123D14569C33C22A4044DA0A3AF048C6E1D87": {
          "DVTSourceControlBranchIdentifierKey": "master",
          "DVTSourceControlBranchOptionsKey": 4,
          "DVTSourceControlWorkspaceBlueprintLocationTypeKey": "DVTSourceControlBranch"
        }
      },
      "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey": "F04123D14569C33C22A4044DA0A3AF048C6E1D87",
      "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey": {},
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryAuthenticationStrategiesKey": {
        "F04123D14569C33C22A4044DA0A3AF048C6E1D87": {
          "DVTSourceControlWorkspaceBlueprintRemoteRepositoryAuthenticationTypeKey": "DVTSourceControlAuthenticationStrategy"
        }
      },
      "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey": {
        "F04123D14569C33C22A4044DA0A3AF048C6E1D87": 0
      },
      "DVTSourceControlWorkspaceBlueprintIdentifierKey": "21781505-0D2A-4109-8B12-873D31EF3654",
      "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey": {
        "F04123D14569C33C22A4044DA0A3AF048C6E1D87": "Billboard/"
      },
      "DVTSourceControlWorkspaceBlueprintNameKey": "Billboard",
      "DVTSourceControlWorkspaceBlueprintVersion": 204,
      "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey": "Billboard.xcworkspace",
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey": [
        {
          "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey": "github.com:kdawgwilk/Billboard.git",
          "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey": "com.apple.dt.Xcode.sourcecontrol.Git",
          "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey": "F04123D14569C33C22A4044DA0A3AF048C6E1D87"
        }
      ]
    }
  },
  "requiresUpgrade": false,
  "name": "Billboard Bot",
  "type": 1,
  "integration_counter": 17,
  "doc_type": "bot",
  "tinyID": "C3B0A83",
  "lastRevisionBlueprint": {
    "DVTSourceControlWorkspaceBlueprintLocationsKey": {
      "F04123D14569C33C22A4044DA0A3AF048C6E1D87": {
        "DVTSourceControlBranchIdentifierKey": "master",
        "DVTSourceControlLocationRevisionKey": "d780cd9ff131125b8ac54eb80e631f707cc94c87",
        "DVTSourceControlBranchOptionsKey": 4,
        "DVTSourceControlWorkspaceBlueprintLocationTypeKey": "DVTSourceControlBranch"
      }
    },
    "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey": "F04123D14569C33C22A4044DA0A3AF048C6E1D87",
    "DVTSourceControlWorkspaceBlueprintIdentifierKey": "58D63A34-CDAF-4B95-BA04-1557D186F080",
    "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey": {
      "F04123D14569C33C22A4044DA0A3AF048C6E1D87": "Billboard/"
    },
    "DVTSourceControlWorkspaceBlueprintNameKey": "Billboard",
    "DVTSourceControlWorkspaceBlueprintVersion": 204,
    "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey": "Billboard.xcworkspace",
    "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey": [
      {
        "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey": "github.com:kdawgwilk/Billboard.git",
        "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey": "com.apple.dt.Xcode.sourcecontrol.Git",
        "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey": "F04123D14569C33C22A4044DA0A3AF048C6E1D87"
      }
    ]
  }
}

Versus the Response on Apples docs and what is being used in XcodeServerSDK:

{
  "_id": "b31ad8317300e89b2db73aad3d0194ad",
  "_rev": "17-869fccee9b37638a719c20b1dcfa6869",
  "number": 1,
  "result": "succeeded",
  "success_streak": 1,
  "bot": {
    ...
  },
  "shouldClean": false,
  "doc_type": "integration",
  "currentStep": "completed",
  "queuedDate": "2015-07-20T21:30:58.971Z",
  "buildServiceFingerprint": "9C:67:D4:4A:00:97:0F:22:7B:B1:68:7E:28:1D:E0:5E:F2:E4:45:7C",
  "startedTime": "2015-07-20T21:30:59.669Z",
  "revisionBlueprint": {
    ...
  },
  "buildResultSummary": {
    "analyzerWarningCount": 0,
    "testFailureCount": 0,
    "testsChange": 220,
    "errorCount": 0,
    "testsCount": 220,
    "testFailureChange": 0,
    "warningChange": 0,
    "regressedPerfTestCount": 0,
    "warningCount": 0,
    "errorChange": 0,
    "improvedPerfTestCount": 0,
    "analyzerWarningChange": 0,
    "codeCoveragePercentage": 0,
    "codeCoveragePercentageDelta": 0
  },
  "endedTime": "2015-07-20T21:31:23.906Z",
  "endedTimeDate": [
    2015,
    7,
    20,
    21,
    31,
    23,
    906
  ],
  "duration": 24.237,
  "ccPercentage": 0,
  "ccPercentageDelta": 0,
  "testedDevices": [
    {
      "osVersion": "10.11",
      "connected": true,
      "simulator": false,
      "modelCode": "MacBookPro11,3",
      "deviceType": "com.apple.mac",
      "modelName": "MacBook Pro",
      "revision": "3-824d6d3e1adedab99b103ab21f6b330d",
      "modelUTI": "com.apple.macbookpro-15-retina-display",
      "name": "server.mycompany.com",
      "trusted": true,
      "doc_type": "device",
      "supported": true,
      "processor": "2.5 GHz Intel Core i7",
      "identifier": "686EE427-E12F-50DF-9D20-455B7E3F15CE-x86_64",
      "enabledForDevelopment": true,
      "serialNumber": "XYZ",
      "platformIdentifier": "com.apple.platform.macosx",
      "ID": "b31ad8317300e89b2db73aad3d005719",
      "architecture": "x86_64",
      "retina": false,
      "isServer": true
    }
  ],
  "testHierarchy": {
    "Sketch": {
      "SketchTests": {
        "testFileWithPath": {
          "676EE417-E15F-50DF-9D20-525B7E3F13CE-x86_64": 1
        },
        "testInitiWithPath": {
          "676EE417-E15F-50DF-9D20-525B7E3F13CE-x86_64": 1
        }
      }
    }
  },
  "perfMetricNames": [
    "Time"
  ],
  "perfMetricKeyPaths": [
    "Sketch.SketchTests.testPerfOpenFile"
  ]
}

Is there anything I can do to fix this? Or has the API totally changed?

czechboy0 commented 8 years ago

The first one is a Bot, the second one is an Integration payload. I haven't seen any reports of the API changing. Is something failing for you?

kdawgwilk commented 8 years ago

Thats wierd the top response is from the bot endpoint because this the request I am sending https://server.example.com:20343/api/integrations/d527eca6aaac9f039f79924d5400cfc2

kdawgwilk commented 8 years ago

I am running OS X Server 5.0.15 with Xcode 7.1.1

XcodeServerSDK would crash when calling the server.getIntegrations call

czechboy0 commented 8 years ago

I tried it and for some reason, when you pass a bot id into the path, you do get a bot back even with the /integrations endpoint, that shouldn't be the case, definitely should fail (if you radar this I'll dup it). However, that id above that you have in your url must be a bot id, not an integration id. If you actually supply an integration id (which it's expecting), you get an integration back.

kdawgwilk commented 8 years ago

Do I list the radar under OS X server? or Xcode?

kdawgwilk commented 8 years ago

Also if I try to make this call

server.getIntegrations { integrations, error in
                if let firstIntegration = integrations?.first {
                    print(firstIntegration.buildResultSummary!.testsCount)
                } else {
                    print("Error: \(error?.description)")
                }
            }

I get this in the console:

Error: Optional("Error Domain=com.honzadvorsky.Buildasaur Code=0 \"Wrong body Optional({\n    message = \"unable to parse the query string\";\n    status = 400;\n})\" UserInfo={NSLocalizedDescription=Wrong body Optional({\n    message = \"unable to parse the query string\";\n    status = 400;\n})}")
czechboy0 commented 8 years ago

That looks like a genuine bug in XcodeServerSDK, can you please open a new ticket for that? Thanks!

czechboy0 commented 8 years ago

Tracked in #127