                                    pipeline-groups)]
     (println "Looking at pipeline groups" (map :name selected-pipeline-groups))
     (println "Syncing all builds starting from" (tf/unparse (:date-time tf/formatters) load-builds-from))
+    (when (some? accumulate-stages-for-pipelines)
+      (println "Aggregating jobs for stages of" accumulate-stages-for-pipelines))
 
     (println "Finding all builds for syncing...")
 
     (let [builds-to-be-synced (->> selected-pipeline-groups
                                  (mapcat stages-for-pipeline-group)
-                                 (mapcat (partial job-instances-for-stage load-builds-from))
+                                 (mapcat (partial job-instances-for-stage load-builds-from accumulate-stages-for-pipelines))
                                  (sort-by :scheduledDateTime))]
     (println (format "Found %s builds to be synced, starting" (count builds-to-be-synced)))
 

  (let [build (get-json "/jobStatus.json?pipelineName=&stageName=&jobId=%s" jobId)]
    (parse-build-info build)))

(defn job-data-for-instance [jobInstance]
  (assoc jobInstance :build (build-for jobInstance)))


;; /api/stages/%pipeline/%stage/history

  (println "Go" go-url "-> buildviz" buildviz-url)

  (let [load-builds-from (get-start-date (:load-builds-from (:options args)))
        accumulate-stages-for-pipelines (set (:aggregate-jobs-for-pipelines (:options args)))
        selected-pipeline-group-names (set (drop 1 (:arguments args)))
        pipeline-groups (get-pipeline-groups)
        selected-pipeline-groups (if (seq selected-pipeline-group-names)
