 
 ;; /jobStatus.json
 
-(defn parse-build-info [jsonResp]
-  (let [buildInfo (:building_info (first jsonResp))
+(defn parse-build-info [json-response]
+  (let [buildInfo (:building_info (first json-response))
         buildStartTime (tc/to-long (tf/parse (:build_building_date buildInfo)))
         buildEndTime (tc/to-long (tf/parse (:build_completed_date buildInfo)))
         result (:result buildInfo)

  (let [stageHistory (get-json "/api/stages/%s/%s/history" pipeline stage)
        stageInstances (:stages stageHistory)]
    (map #(assoc % :stageName stage :pipelineName pipeline)
         (apply concat
                (map job-instances-for-stage-instance stageInstances)))))


;; /api/pipelines/%pipelines/instance/%run

  (let [pipelineGroups (get-json "/api/config/pipeline_groups")
        pipelineGroup (first (filter #(= pipelineGroupName (:name %)) pipelineGroups))
        pipelines (:pipelines pipelineGroup)]
    (mapcat stages-for-pipeline pipelines)))


;; upload
