Jenkins CI Results CSV - jenkins

I am attemtping to integrate Jenkins CI and APtest so that my Jenkins run will automatically update APtest results.
I have the ApTest importresults script below but need a way to generate the appropiate CSV file containing all results data from Jenkins.
Can someone help?
APTest import results.

Do you need all results data in the history of the job / system dumped every single time? Or are you looking for an incremental CSV after the completion of each build?

Related

Update delay for dataflow UDF

I have a dataflow from pub/sub to bigquery that uses a javascript UDF to manipulate data. If I modify the file in cloud storage, does the running dataflow automatically update to start using this new UDF, is there a delay or do I have to trigger it manually? I changed the UDF but the dataflow behaves as if it were running with the old one.
Also, what is the best way to debug these UDF that run on dataflow?
Thanks!
You mean the Dataflow Template, right?
Unfortunately, the UDF does not refresh when you change the file. To update with a new file, you need to perform a Pipeline update, or stop / restart your pipeline.
As for debugging the UDFs, I am not sure what's the best way; but you can access the pipeline code in the DataflowTemplates repository in Github, and debug the pipeline by running locally, or writing a reduced version of it.

How to programmatically generate config.xml from Jenkinsfile?

Jenkins has the ability to upload new jobs via its REST API. Those new jobs require an XML document which, to the best of my searching, has no schema available.
When creating jobs as part of an SCM repo, you can include a Jenkinsfile and it automatically gets translated into a job with the config.xml filled out.
I tried creating a minimal config.xml and including the Jenkinsfile content in the <script>…</script> section of the xml file. This works for trivial jobs, but does not work for jobs that have parameters: The job gets uploaded as a parameterless job. The first time you trigger a build of the job, it fails - but then the job turns into a job-with-parameters, and can properly be built.
How do I convert a Jenkinsfile, possibly with parameters or other "advanced" features, into a working config.xml file on the first try? Or, alternatively, is it possible to directly upload the Jenkinsfile to the Jenkins REST API to create the job?
Thanks in advance,
— Johnson

Jenkins job to read data from SQL DB

I'm new to Jenkins. I have a task where I need to create a Jenkins job to automate builds of certain projects. The build job parameters are going to be stored in the SQL database. So, the job would keep querying the DB and it has to load data from the DB and perform the build operation.
Examples would be greatly appreciated.
How can this be done?
You have to transform the data from available source to the format expecting by the destination.
Here your source data available in DB and you want to use this data in Jenkins.
There might be numerous ways but the efficient way of reading data is using EnvyInJect Plugin.
If you were able to provide the whole data as Properties file format and type to EnvyInject plugin, the whole data is available as environment variables you can use these variable in the Jobs configuration.
EnvyInject Plugin can read this properties file from the Jenkins Job Workspace. And you can provide that file path in Properties File Path input.
To read the data from source and make available as properties file.
Either you can write a executable or if your application provides api to download the properties data.
Both ways to be executed before the SCM step, for this you have to use Pre-SCM-Step
Get the data and inject the data in pre-scm-step only, so that the data available as environment variables.
This is one thought to give gist for you to start. while implementing you may get lot of thoughts to implement according to your requirement.

Integrate jenkins to Power BI

How can I integrate Jenkins to POWERBI, i.e, getting jenkins jobs build and failed And JOb NUMBERS to POWERBI.
I don't thing there is a direct way of doing it currently.
(https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/6798689-jenkins-data-source)
But as a workaround you can always create a groovy script to read jenkins log and use database to store data.
From there you can use powerBI to create reports.

How do I get a list of jobs with longest build time in Jenkins

I need to generate a weekly report on our Jenkins build cluster. One of the reports is to display a list of jobs that have the longest build time.
The solution I can come up with is to parse the "Build history" page on each slave (also master) and for each build of a job, parse the build page and look for "Took x min x sec on slave-xx".
This feels quite cumbersome, does anyone know a better solution using Jenkins API or Groovy script console?
Thanks
You can get the build data for your report through the Jenkins API. For a given job, you can
retrieve the list of builds with duration information using something like:
http://jenkins:8080/job/my-job/api/json?tree=builds[id,number,duration,timestamp,builtOn]
To see a list of all the API-available build data for a given job:
http://jenkins:8080/job/my-job/api/json?tree=builds[*]
Once you have a query that retrieves the job information that you need for
your report, it should be straightforward to loop over the jobs.
Most Jenkins pages have a link at the bottom to the REST API that describes a bit about accessing the API for that page, e.g. http://jenkins:8080/job/my-job/api.
How about using plugins?
Check this out:
https://wiki.jenkins-ci.org/display/JENKINS/build-metrics-plugin
There are few others too which you can try depending on how much customization/features you want to do/display:
https://wiki.jenkins-ci.org/display/JENKINS/Global+Build+Stats+Plugin - This is quite extensive
https://wiki.jenkins-ci.org/display/JENKINS/Project+Statistics+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/eXtreme+Feedback+Panel+Plugin

Resources