Git Product home page Git Product logo

lambdacd-cctray's Introduction

CCTray support for LambdaCD

Exposes a cctray.xml for your LambdaCD pipeline to integrate with build monitoring tools such as nevergreen or CCMenu

Status

Build Status

Clojars Project

Usage

Single pipeline

(:require [lambdacd-cctray.core :as cctray])

(let [pipeline (lambdacd/assemble-pipeline pipeline/pipeline-def {:ui-url "http://some-base-url"})
      cctray-pipeline-handler (cctray/cctray-handler-for pipeline)

  ; ...

  (GET "/cctray/pipeline.xml" [] cctray-pipeline-handler)

For a full example, see test/lambdacd_cctray/sample_pipeline.clj

Multiple pipelines

(:require [lambdacd-cctray.core :as cctray])

(let [some-pipeline (lambdacd/assemble-pipeline pipeline/some-pipeline-def {:ui-url "http://some-base-url/some-pipeline"})
      some-other-pipeline (lambdacd/assemble-pipeline pipeline/some-other-pipeline-def {:ui-url "http://some-base-url/some-other-pipeline"})
      cctray-pipeline-handler (cctray/cctray-handler-for [some-pipeline some-other-pipeline])

  ; ...

  (GET "/cctray/pipeline.xml" [] cctray-pipeline-handler)

Prefixing

By default the step names in the resulting xml will be prefixed with the corresonding pipeline name. This can be disabled with the key cctray-add-prefix in the pipeline config:

(let [some-pipeline (lambdacd/assemble-pipeline pipeline/some-pipeline-def {:ui-url "http://some-base-url/some-pipeline"
                                                                            :cctray-add-prefix false})
...

Development

Call ./go

License

Copyright © 2014 Florian Sellmayr

Distributed under the Apache License 2.0

lambdacd-cctray's People

Contributors

felixbechstein0000 avatar flosell avatar redvox avatar simonmonecke1708 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lambdacd-cctray's Issues

cannot upgrade to lambdacd 0.14.0

we are trying to upgrade out LambdaCD pipeline
to lambdacd 0.14.0 and lambdaui 1.1.0

However it seems that lambdacd-cctray is preventing us to upgrade:

$ lein run
Exception in thread "main" java.io.FileNotFoundException: Could not locate lambdacd/internal/pipeline_state__init.class or lambdacd/internal/pipeline_state.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name., compiling:(lambdacd_cctray/core.clj:1:1)
        at clojure.lang.Compiler.load(Compiler.java:7526)
        at clojure.lang.RT.loadResourceScript(RT.java:379)
        at clojure.lang.RT.loadResourceScript(RT.java:370)
        at clojure.lang.RT.load(RT.java:460)
        at clojure.lang.RT.load(RT.java:426)
        at clojure.core$load$fn__6548.invoke(core.clj:6046)
        at clojure.core$load.invokeStatic(core.clj:6045)
        at clojure.core$load.doInvoke(core.clj:6029)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5848)
        at clojure.core$load_one.invoke(core.clj:5843)
        at clojure.core$load_lib$fn__6493.invoke(core.clj:5888)
        at clojure.core$load_lib.invokeStatic(core.clj:5887)
        at clojure.core$load_lib.doInvoke(core.clj:5868)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$load_libs.invokeStatic(core.clj:5925)
        at clojure.core$load_libs.doInvoke(core.clj:5909)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$require.invokeStatic(core.clj:5947)
        at clojure.core$require.doInvoke(core.clj:5947)
        at clojure.lang.RestFn.invoke(RestFn.java:619)
        at lambdacd_pipeline.overview.ui_selection$eval3447$loading__6434__auto____3448.invoke(ui_selection.clj:1)
        at lambdacd_pipeline.overview.ui_selection$eval3447.invokeStatic(ui_selection.clj:1)
        at lambdacd_pipeline.overview.ui_selection$eval3447.invoke(ui_selection.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:7062)
        at clojure.lang.Compiler.eval(Compiler.java:7051)
        at clojure.lang.Compiler.load(Compiler.java:7514)
        at clojure.lang.RT.loadResourceScript(RT.java:379)
        at clojure.lang.RT.loadResourceScript(RT.java:370)
        at clojure.lang.RT.load(RT.java:460)
        at clojure.lang.RT.load(RT.java:426)
        at clojure.core$load$fn__6548.invoke(core.clj:6046)
        at clojure.core$load.invokeStatic(core.clj:6045)
        at clojure.core$load.doInvoke(core.clj:6029)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5848)
        at clojure.core$load_one.invoke(core.clj:5843)
        at clojure.core$load_lib$fn__6493.invoke(core.clj:5888)
        at clojure.core$load_lib.invokeStatic(core.clj:5887)
        at clojure.core$load_lib.doInvoke(core.clj:5868)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$load_libs.invokeStatic(core.clj:5925)
        at clojure.core$load_libs.doInvoke(core.clj:5909)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$require.invokeStatic(core.clj:5947)
        at clojure.core$require.doInvoke(core.clj:5947)
        at clojure.lang.RestFn.invoke(RestFn.java:619)
        at lambdacd_pipeline.core$eval3441$loading__6434__auto____3442.invoke(core.clj:1)
        at lambdacd_pipeline.core$eval3441.invokeStatic(core.clj:1)
        at lambdacd_pipeline.core$eval3441.invoke(core.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:7062)
        at clojure.lang.Compiler.eval(Compiler.java:7051)
        at clojure.lang.Compiler.load(Compiler.java:7514)
        at clojure.lang.RT.loadResourceScript(RT.java:379)
        at clojure.lang.RT.loadResourceScript(RT.java:370)
        at clojure.lang.RT.load(RT.java:460)
        at clojure.lang.RT.load(RT.java:426)
        at clojure.core$load$fn__6548.invoke(core.clj:6046)
        at clojure.core$load.invokeStatic(core.clj:6045)
        at clojure.core$load.doInvoke(core.clj:6029)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5848)
        at clojure.core$load_one.invoke(core.clj:5843)
        at clojure.core$load_lib$fn__6493.invoke(core.clj:5888)
        at clojure.core$load_lib.invokeStatic(core.clj:5887)
        at clojure.core$load_lib.doInvoke(core.clj:5868)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$load_libs.invokeStatic(core.clj:5925)
        at clojure.core$load_libs.doInvoke(core.clj:5909)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$require.invokeStatic(core.clj:5947)
        at clojure.core$require.doInvoke(core.clj:5947)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at user$eval3424$fn__3428.invoke(form-init7320160489578828129.clj:1)
        at user$eval3424.invokeStatic(form-init7320160489578828129.clj:1)
        at user$eval3424.invoke(form-init7320160489578828129.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:7062)
        at clojure.lang.Compiler.eval(Compiler.java:7052)
        at clojure.lang.Compiler.load(Compiler.java:7514)
        at clojure.lang.Compiler.loadFile(Compiler.java:7452)
        at clojure.main$load_script.invokeStatic(main.clj:278)
        at clojure.main$init_opt.invokeStatic(main.clj:280)
        at clojure.main$init_opt.invoke(main.clj:280)
        at clojure.main$initialize.invokeStatic(main.clj:311)
        at clojure.main$null_opt.invokeStatic(main.clj:345)
        at clojure.main$null_opt.invoke(main.clj:342)
        at clojure.main$main.invokeStatic(main.clj:424)
        at clojure.main$main.doInvoke(main.clj:387)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:702)
        at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate lambdacd/internal/pipeline_state__init.class or lambdacd/internal/pipeline_state.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
        at clojure.lang.RT.load(RT.java:463)
        at clojure.lang.RT.load(RT.java:426)
        at clojure.core$load$fn__6548.invoke(core.clj:6046)
        at clojure.core$load.invokeStatic(core.clj:6045)
        at clojure.core$load.doInvoke(core.clj:6029)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5848)
        at clojure.core$load_one.invoke(core.clj:5843)
        at clojure.core$load_lib$fn__6493.invoke(core.clj:5888)
        at clojure.core$load_lib.invokeStatic(core.clj:5887)
        at clojure.core$load_lib.doInvoke(core.clj:5868)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$load_libs.invokeStatic(core.clj:5925)
        at clojure.core$load_libs.doInvoke(core.clj:5909)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$require.invokeStatic(core.clj:5947)
        at clojure.core$require.doInvoke(core.clj:5947)
        at clojure.lang.RestFn.invoke(RestFn.java:482)
        at lambdacd_cctray.core$eval19504$loading__6434__auto____19505.invoke(core.clj:1)
        at lambdacd_cctray.core$eval19504.invokeStatic(core.clj:1)
        at lambdacd_cctray.core$eval19504.invoke(core.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:7062)
        at clojure.lang.Compiler.eval(Compiler.java:7051)
        at clojure.lang.Compiler.load(Compiler.java:7514)
        ... 96 more

Is it possible that lambdacd-cctray is using some deprecated lambdacd features?

Does not display most recent build when retriggering

Consider this scenario:

  • build 4 has successfully run build-steps foo and bar with bar being after foo in the pipeline
  • build 5 runs afterwards, also running completing foo
  • Now we retrigger bar on build 4
  • build 6 appears, with duplicates of the foo results. because cctray orders by build-number, cctray now shows build 6 for foo when this build 6 never actually ran foo but is just there for pipeline consistency. We'd expect build 5 to be the build cctray uses for foo.

Possible fix: sort by :first-updated-at instead of build number.
We could also sort by :most-recent-update-at but this might lead to strange flapping when two builds run a step at the same time.

No such var: lp/display-representation

Hi,
i got lambdacd "0.5.2" and lambdacd-cctray "0.3.0" in my pipeline and then i get

Exception in thread "main" java.lang.RuntimeException: No such var: lp/display-representation, compiling:(lambdacd_cctray/core.clj:64:51)

If i look into the libs of the project, lp/display-representation can not be resolved.
Maybe it should be lp/pipeline-display-representation?

Regards,
Jens

Undetermined behavior for steps that were not yet executed

If a step wasn't executed yet, the cctray.xml shows undetermined data:

<Projects>
<Project name="some sample pipeline :: some-slow-step" activity="Building" lastBuildStatus="Unknown" lastBuildLabel="1" lastBuildTime="2016-11-30T15:09:45.881Z" webUrl="http://localhost:8081/pipeline/#/builds/1/1"/>
<Project name="some sample pipeline :: wait-for-interaction" activity="" lastBuildStatus="Unknown" lastBuildLabel="" lastBuildTime="2016-11-30T15:09:47.411Z" webUrl="http://localhost:8081/pipeline/#/builds//2"/>
<Project name="some sample pipeline :: either" activity="" lastBuildStatus="Unknown" lastBuildLabel="" lastBuildTime="2016-11-30T15:09:47.412Z" webUrl="http://localhost:8081/pipeline/#/builds//3"/>
<Project name="some sample pipeline :: some-failing-step" activity="" lastBuildStatus="Unknown" lastBuildLabel="" lastBuildTime="2016-11-30T15:09:47.412Z" webUrl="http://localhost:8081/pipeline/#/builds//1-3"/>
<Project name="some sample pipeline :: some-successful-step" activity="" lastBuildStatus="Unknown" lastBuildLabel="" lastBuildTime="2016-11-30T15:09:47.412Z" webUrl="http://localhost:8081/pipeline/#/builds//2-3"/>
</Projects>

Notice the last build time is just the current time, lastBuildLabel and activity are empty strings and the web-url does not contain a build-number.
Instead, we should aim something that gives users at least some value, i.e. a build that hasn't been running yet is probably sleeping, we can point to the url of the most recent build, ...

Make using prefix configurable

Hi Flosell,

we don't need the new prefix feature because we have separate cctrays for our pipelines.
It would be nice if we could disable the use of prefixes.

use-prefix (... config)
name (if (and use-prefix pipeline-name)
    (str pipeline-name " :: " step-name)
    step-name)

Regards,
Miriam & Simon

Make interface more compatible with recent LambdaCD versions

LambdaCD-CCTray still relies on the internal state atom earlier versions of LambdaCD relied on.

This internal state has since been encapsulated into pipeline state component. Use those instead!

Workaround:
fetch the state components internal state and use this as the state-atom:

(defn get-internal-state [pipeline]
  (pipeline-state/get-internal-state (:pipeline-state-component (:context pipeline))))

Add Access-Control-Allow-Origin to respnse header for cross domain requests

To test our build monitor I need to run it on my develop machine located in another domain. Because of this the monitor doesn't have the permission to request the cctray of the pipeline.
Please add

"Access-Control-Allow-Origin" "*"

to the response header to enable cross domain monitoring. Because of security risks I would suggest a fourth optional parameter for the function cctray-handler-for. You can just make a simple signature switch to have a default value ("*") and let people restrict requests to their domain if they want it.

Regards,
Simon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.