plouc / mozaik-ext-jenkins Goto Github PK
View Code? Open in Web Editor NEWMozaïk jenkins widgets
License: MIT License
Mozaïk jenkins widgets
License: MIT License
I use jenkins 2.19.3.
I want to display build status but I get an error "cannot call toUpperCase on null". This is because you add className based on result "FAILURE" "SUCCESS"...The problem is when build is in "in-progress" state "result" attribute is null.
Possible solution:
Jenkins returns flag "building":
"building" : true,
"displayName" : "#4333",
"duration" : 0,
"estimatedDuration" : 1384140,
"id" : "4333",
"result" : null,
We can base on that flag and add different className for "in-progress" builds.
No errors in browser console + new style for "in-progress" builds.
Error in browser console. Empty list of build. Unknown status of build.
Added extention using npm i mozaik-ext-jenkins --save
and module if physically installed.
In app.js
, added mozaik.bus.registerApi('jenkins', require('mozaik-ext-jenkins/client'));
I can see info: registered API "jenkins"
when starting server.
But nothing appears, and I can see this message in my browser console:
Uncaught Error: No component defined for type "jenkins.jobs"
Tried with other widget and same problem.
Am I missing something?
Thank you @plouc
Is there a way to configure multiple Jenkins instance?
I tried to change jenkins
to jenkinsA
and jenkinsB
in the config file and calling jenkinsA.job_status
, but it doesn't work.
Before digging more, I was wondering if you know an existing solution.
Thank you.
Hello!
When trying to use this plugin I get this error [jenkins] Error: unable to verify the first certificate
. This is because of a custom CA provided to me by my company, but superagent is not used by mozaik in a way that it is configurable to pick up a specific certificate.
Since I need this certificate when I deploy my dashboard I think it would be nice to share my solution to this problem, see coming pull request.
I'm testing Mozaik with 2 different Jenkins, both having the rest json enabled and exposing data to my jenkins user.
I'm getting a status code: undefined
error on one of them.
Before I dig inside, I was wondering:
Thank you.
I tried setting up mozaik-ext-jenkins (using mozaik v1) setup seems alright:
mozaik-demo/
/config.js
api
jenkins: {
baseUrl: 'https://...',
basicAuthUser: 'usr',
basicAuthPassword: 'pwd'
}
widgets
{
type: 'jenkins.job_builds', job: 'Feature-Branch-Pipeline-SEO',
columns: 1, rows: 1, x: 0, y: 0
},
/App.jsx
import jenkins from 'mozaik-ext-jenkins';
Mozaik.Registry.addExtensions({jenkins});
/server.js
import jenkins from 'mozaik-ext-jenkins/client';
mozaik.bus.registerApi('jenkins', jenkins);
Above seems to work, i am however greeted with a empty widget and below output in in stdout:
info: Added subscription 'jenkins.job.Feature-Branch-Pipeline-SEO '
info: Calling 'jenkins.job.Feature-Branch-Pipeline-SEO '
info: [jenkins] fetching from https://.../job/Feature-Branch-Pipeline-SEO/api/json?pretty=true&depth=10&tree=builds[number,duration,result,builtOn,timestamp,id,building]: [object Object]
info: Setting timer for 'jenkins.job.Feature-Branch-Pipeline-SEO '
error: [jenkins] undefined
error: [jenkins] jenkins.job.Feature-Branch-Pipeline-SEO - status code: undefined
I have suspicion that its my self-signed certificate that is making a fuss, how can i debug this?
Are you aiming at converting the jenkins extension for mozaik v2, pointers on how i can do it myself?
item | info | notes |
---|---|---|
node version | v8.10.0 | output from node --version |
npm version | 5.6.0 | output from npm --version |
mozaik-ext-jenkins version | 1.2.0 | available in project's package.json |
jenkins version | 1.3.3 | your jenkins server version |
mozaik version | 1.4.4 | available in project's package.json |
mozaik-demo version | latest on github today | version of the demo used, depends on which method you used to setup your Mozaïk dashboard |
component | name of the extension's component or client if it's related to the extension's client |
|
browser | Chromium | browser used, applyable if the issue is not related to the client |
Display of a jenkins widget
"Uncaught Error: No component defined for type 'jenkins.view' in the debug console and nothing displayed on the dashboard. I'm sure this is something trivial that's missing that will be obvious to a seasoned Mozaik user, but it's not immediately clear as someone who's never used it before. I had assumed that the API endpoints would all show up automatically after installing the jenkins module.
type: jenkins.view,
view: 'Tooling',
columns: 1, rows: 1, x: 0, y: 2
Also one further question - is it valid to leave the user/password options unset to allow the module to access a jenkins instance which can be viewed without authentication?
module.exports.jobBuild
in ./src/client.js line 65 is undefined
When I tried moving jobBuild
outside of the returned object it worked.
Not sure how you wanna address this @plouc, related issue is that jobs
returns literally all jobs, not only for the requested view (this might be jenkins' fault though, not sure)
Hi @plouc, how are you mate?
Really nice work on Mozaïk. I'm currently trying it because I need an Enterprise dashboard.
Just a question regarding the Jenkins configuration.
The README
says:
{
//…
api: {
jenkins: {
baseUrl: 'https://my-jenkins.ci',
auth: {
user: 'user',
password: 'password'
}
}
}
}
But I think it should be:
{
//…
api: {
jenkins: {
baseUrl: 'https://my-jenkins.ci',
basicAuthUser: 'user',
basicAuthPassword: 'password'
}
},
}
When I use your config, the server doesn't start and I see:
error: jenkins.basicAuthUser: must be of type String
jenkins.basicAuthPassword: must be of type String
Let me know, I'll be happy to PR this!
item | info | notes |
---|---|---|
node version | v5.9.1 | output from node --version |
npm version | 3.7.2 | output from npm --version |
mozaik-ext-jenkins version | 1.655 | available in project's package.json |
jenkins version | 1.655 | your jenkins server version |
mozaik version | ^1.1.0 | available in project's package.json |
mozaik-demo version | N/A | version of the demo used, depends on which method you used to setup your Mozaïk dashboard |
component | jenkins.job_builds | name of the extension's component or client if it's related to the extension's client |
browser | Chrome 49.0.2623.87 | browser used, applyable if the issue is not related to the client |
While a job is building, display the job in the list of job builds with the status building.
The building job is not displayed in the list.
(This is somewhere between a bug report and a feature request and would like your feedback.)
Trigger a Jenkins job and refresh your dashboard. This requires a little bit of timing, depending on how long your Jenkins job runs. I've found in certain conditions that visiting the dashboard while a certain job is building prevents any JobBuild
components from being displayed in the JobBuilds
widget.
In this case, I see:
When no jobs are building, I see all job builds in the list, as expected.
I noticed that the JobBuild
component takes the build.result
and displays it with toLowerCase()
([code is here(https://github.com/plouc/mozaik-ext-jenkins/blob/v1.1.0/src/components/JobBuild.jsx#L9))
According to the Jenkins API endpoints I am hitting, which I believe to be the case for all versions of the Jenkins API:
Building job object
{
"building" : true,
"duration" : 0,
"id" : "1",
"number" : 1,
"result" : null,
"timestamp" : 1459278308034,
"builtOn" : ""
}
Completed job object
{
"building" : false,
"duration" : 10025,
"id" : "1",
"number" : 1,
"result" : "SUCCESS",
"timestamp" : 1459278308034,
"builtOn" : ""
}
For a building job, result
== null, where I think the weird behavior is happening where no jobs are shown when build.result.toLowerCase()
is called in JobBuild
. I don't see any logs for this, though, so this is a guess.
So long story short, I guess this is a feature request for properly displaying the pending build status of a JobBuild
. I would be glad to look into this, as I would like this for my company's dashboard.
Let me know if you have any questions or input about this behavior/idea.
Any chance of a new 1.3.0 tag and an updated npm package?
I'd love to help out but not exactly sure how to do either (nodejs novice).
item | info | notes |
---|---|---|
node version | 4.6.0 | |
npm version | 3.10.8 | |
mozaik-ext-jenkins version | 1.2.0 | |
jenkins version | 1.609.2 | |
mozaik version | 1.4.4 | |
mozaik-demo version | current | |
component | name of the extension's component or client if it's related to the extension's client |
|
browser | Chrome, firefox |
Description of the actual behavior.
Followed the install instructions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.