2016-11-24 14 views
0

XCode Bots APIを使用して、ボットのスキーム名を変更します。 bot-nameを変更するには、curl -XPATCH -H 'Content-Type:application/json' -H 'x-xcsclientversion:8' https://localhost:20343/api/bots/botid123 -d '{"name": "myawesomebot2"}のような要求が機能します。しかし、 '{"configuration":{"schemeName": "scheme2"}}}のようなリクエストボディで設定オブジェクトを変更しようとすると失敗します。XCode Bots API設定の編集が失敗しました

スキーム名はどのように変更できますか?

+0

あなたはこれを理解しましたか? これまでのテストでは、-d JSONペイロードを '{"name": "cool_bot"、 "configuration":{"scheduleType":2}}' と設定できました。それ。sourceControlBlueprintのようなものへの変更(ボットがリポジトリ上の新しいブランチを指すことができるように)は、無視されるか、オブジェクトのクラス((null))がXCSBotConfigurationのサブクラスではありません。 、 私は推測する? あなたは解決策に到達しましたか? – christopherdrum

答えて

0

私はついにこれを解決し、この作業を行うために必要な部分と、それを見つけた方法に注意したいと思います。

まず、あなたはすでに気づいて、Xcodeのサーバーの更新Aを見た後-H "x-xcsclientversion: #"の必要性(ノート、PATCH要求を受け、アップルのJavaScriptのチェックを発見したとして6が、私のために働いていた)

第二に、ありますチャールズによるボットは、URLが追加され、次のパラメータを必要としていることを見られた?overwriteBlueprint=true

第三に、name:として最上位レベルでのJSONデータは、またrequiresUpgrade=falsetype=1

I found the tool jqは非常に貴重であることを)必要としているようです

第4に、sourceBlueprintに変更すると、新しいUUIDを受け取るにはconfiguration.sourceControlBlueprint.DVTSourceControlWorkspaceBlueprintIdentifierKeyが必要です。簡単にuuidgenコマンドでbashで生成されます。

第5に、ほとんど完全なボットの説明を送信する必要があります。私は、AppleのAPIを使ってボットのJSON定義を取得し、jq(上記を参照)を使用して変更し、不要なキーと値のペアを削除して、Xcodeサーバー自身のAPI呼び出しに一致させました。

  • 名前構成(必要に応じて変更が、完全なコンフィギュレーションが送信されなければならない)
  • 基(ままのまま
  • タイプ
  • requiresUpgrade
  • :必要なキー/値のペアがあるように見えますあなたは戻ってそれを送り返します)

第6に、バックスラッシュでJSONペイロードのスラッシュをエスケープします。私はESCAPED_JSON=${BOT_CONFIG_JSON//\//\\\/}でこれをbashで行いました。そして、私はcurlコマンドで-d "$ESCAPED_JSON"を送っています。そのように、私が使用しているフルカールコマンドは

を次のようになります。

curl -k --request PATCH -H "Content-Type: application/json" -H "x-xcsclientversion: 6" -d "$ESCAPED_JSON" https://<username>:<password>@<your_server_address>:20343/api/bots/<your_bot_id>?overwriteBlueprint=true 

とフルJSON定義は(それが前方を送信する前にエスケープスラッシュ持っている必要があります、覚えておいてください)この

<!-- language: lang-json --> 
    "requiresUpgrade": false, 
    "configuration": { 
    "triggers": [ 
     { 
     "phase": 1, 
     "scriptBody": "<REDACTED>", 
     "type": 1, 
     "name": "Update github Pending", 
     "conditions": { 
      "status": 2, 
      "onSuccess": true, 
      "onAnalyzerWarnings": true, 
      "onBuildErrors": true, 
      "onWarnings": true, 
      "onFailingTests": true 
     } 
     }, 
     { 
     "phase": 2, 
     "scriptBody": "<REDACTED>", 
     "type": 1, 
     "name": "Upload to Beta", 
     "conditions": { 
      "status": 2, 
      "onSuccess": true, 
      "onAnalyzerWarnings": true, 
      "onBuildErrors": false, 
      "onWarnings": true, 
      "onFailingTests": false 
     } 
     }, 
     { 
     "phase": 2, 
     "scriptBody": "<REDACTED>", 
     "type": 1, 
     "name": "Update github status", 
     "conditions": { 
      "status": 2, 
      "onSuccess": true, 
      "onAnalyzerWarnings": true, 
      "onBuildErrors": false, 
      "onWarnings": true, 
      "onFailingTests": false 
     } 
     } 
    ], 
    "performsUpgradeIntegration": true, 
    "disableAppThinning": true, 
    "deviceSpecification": { 
     "filters": [ 
     { 
      "platform": { 
      "_id": "3c884e2499df662057e8c64580003419", 
      "displayName": "iOS", 
      "_rev": "8-51c114fcfc83ea5f36df66f119b34ec8", 
      "simulatorIdentifier": "com.apple.platform.iphonesimulator", 
      "identifier": "com.apple.platform.iphoneos", 
      "buildNumber": "14C89", 
      "version": "10.2" 
      }, 
      "filterType": 3, 
      "architectureType": 0 
     } 
     ], 
     "deviceIdentifiers": [ 
     "6d928bd891b83b4b8592aedb42001a97", 
     "6d928bd891b83b4b8592aedb4200776c", 
     "fa737f03db7b6c04d4c7f9507100700f" 
     ] 
    }, 
    "periodicScheduleInterval": 0, 
    "schemeName": "<REDACTED>", 
    "codeCoveragePreference": 2, 
    "performsTestAction": true, 
    "scheduleType": 3, 
    "performsArchiveAction": true, 
    "builtFromClean": 2, 
    "buildConfiguration": "Release", 
    "performsAnalyzeAction": true, 
    "sourceControlBlueprint": { 
     "DVTSourceControlWorkspaceBlueprintLocationsKey": { 
     "A2739AD29C3BCDF8619D0305ACFDD0C22AEBDDB1": { 
      "DVTSourceControlWorkspaceBlueprintLocationTypeKey": "DVTSourceControlLockedRevisionLocation", 
      "DVTSourceControlLocationRevisionKey": "9d38dc7507f0f6ac17072d721893f0021c5282ed" 
     }, 
     "51DBFAD1848AC646B864BBBEDC625B8BAB305A76": { 
      "DVTSourceControlBranchIdentifierKey": "<THE BRANCH TO WATCH>", 
      "DVTSourceControlBranchOptionsKey": 4, 
      "DVTSourceControlWorkspaceBlueprintLocationTypeKey": "DVTSourceControlBranch" 
     } 
     }, 
     "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey": "51DBFAD1848AC646B864BBBEDC625B8BAB305A76", 
     "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey": {}, 
     "DVTSourceControlWorkspaceBlueprintRemoteRepositoryAuthenticationStrategiesKey": { 
     "A2739AD29C3BCDF8619D0305ACFDD0C22AEBDDB1": { 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryAuthenticationTypeKey": "DVTSourceControlAuthenticationStrategy" 
     }, 
     "51DBFAD1848AC646B864BBBEDC625B8BAB305A76": { 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryAuthenticationTypeKey": "DVTSourceControlAuthenticationStrategy" 
     } 
     }, 
     "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey": { 
     "A2739AD29C3BCDF8619D0305ACFDD0C22AEBDDB1": 0, 
     "51DBFAD1848AC646B864BBBEDC625B8BAB305A76": 0 
     }, 
     "DVTSourceControlWorkspaceBlueprintIdentifierKey": "<GENERATE A NEW UUID FOR THIS!!!>", 
     "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey": { 
     "A2739AD29C3BCDF8619D0305ACFDD0C22AEBDDB1": "<REDACTED PATH 1>", 
     "51DBFAD1848AC646B864BBBEDC625B8BAB305A76": "<REDACTED PATH 2>" 
     }, 
     "DVTSourceControlWorkspaceBlueprintNameKey": "Cool Blueprint", 
     "DVTSourceControlWorkspaceBlueprintVersion": 204, 
     "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey": "<REDACTED>.xcworkspace", 
     "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey": [ 
     { 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey": "[email protected]:<REDACTED REPO 1>", 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey": "com.apple.dt.Xcode.sourcecontrol.Git", 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey": "A2739AD29C3BCDF8619D0305ACFDD0C22AEBDDB1" 
     }, 
     { 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey": "[email protected]:<REDACTED REPO 2>", 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey": "com.apple.dt.Xcode.sourcecontrol.Git", 
      "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey": "51DBFAD1848AC646B864BBBEDC625B8BAB305A76" 
     } 
     ] 
    }, 
    "exportsProductFromArchive": true, 
    "weeklyScheduleDay": 0, 
    "minutesAfterHourToIntegrate": 0, 
    "testingDestinationType": 0, 
    "hourOfIntegration": 0, 
    "testingDeviceIDs": [] 
    }, 
    "group": { 
    "name": "41A62776-A72E-44C0-BFF0-D91F699BBA6A" 
    }, 
    "type": 1, 
    "name": "My Cool Integration Bot" 
のように見えます

私はこれが助けてくれることを願っています。

+0

同様に、xcodeはボットを更新します。ほぼ完全なconfig jsonオブジェクトを送信します。更新されたプロパティのみを送信することは機能していないようです。それがうまくいくと書かれていても。 – ideveloper

+0

正確に正しい。結局のところ、私の成功はXcodeができるだけ正確に行うことを模倣することから来ました。なぜなら、必要ではないようなデータを送信すること(なぜすべての統合スクリプトを再送するのでしょうか? – christopherdrum

関連する問題