Jenkins API filter artifacts - json

The Jenkins API documentation is pretty well written and clear on what you can get.
So to get a list of all artifacts you could request http://jenkins/job/myjob/../api/json?tree=artifacts[*].
What I was not able to find is a way to filter this list of artifacts, like e.g. http://jenkins/job/myjob/../api/json?tree=artifacts[relativePath="/dist/**/theme.min.css"].
Is there a way to filter artifacts like this?
I would like to use the tree parameter instead of xml with xpath and exclude to avoid the memory spike on the server while building the DOM (as mentioned in the docs)

Related

Need a method for deleting/ignoring Solr index records with a particular string in a field

This is a bit hard to explain so bear with me. We have a website that uses a built-in Solr product to index or remove content when it is added/updated/deleted. Standard web content is specifically tagged as published or private, so it is easy to exclude private content from our custom search engine. However, binary files (DOCs, PDFs, etc.) do not have a public/private workflow state. The only way we can determine if a file is private is that, for some reason, the CMS doubles-up the FullURL string. So the URL will have two instances of "http" in the string. Not sure why that happens, but it's a good thing b/c it's the only way to tell if a file is published or private.
Because the Solr install that's packaged with the CMS is so wonky, and b/c we have numerous other sites in other CMSes, we have a "catalog" Solr install in AWS that aggregates content from our various web properties using a data import handler. So what I'm looking for is a way, using the DIH data-config.xml file, to exclude any index records that have "http" in the URL string twice. I'm currently using a filter query (fq) field in the tag to filter out certain records, but I don't know how to write a fq to do what I'm suggesting above or if that's even possible. My hunch is that I'd need a function query, but that's a level of Solr knowledge I haven't yet achieved. If anyone has an advice or knows how to write a function query that would exclude a url field with two instances of "http" in the string I'd appreciate it!

Cypress mocha-junit-reporter - pass test filename to reporter output filename

I'm using Cypress to run a suite of automated tests.
The current version of cypress provides mocha-junit-reporter out of the box, and provides configuration options to pass to the reporter. One of the options is the 'mochaFile'.
I'm using the recommended [hash] tag to output reports across multiple spec files.
this results in a flat mess of files that look like 'results/test-output-abc12345.xml'.
What I want instead is for the test file's relative path and filename to be pass in as the reporter's output file path.
This would give me a structured, feature first view of the output, and in Azure Dev Ops, which aggregates the test output, it would give me correct filenames to detect intermittently failing tests.
Things I've tried that haven't worked:
I've tried to use hooks to modify Cypress's config or set environment variables to try to override the reporterOptions/mochaFile per test at (hopefully) the right time.
I've tried to grab the outputted defaultly-named xml file, and copy it to the correct path+filename given the Cypress.spec.name context, but I can't seem to find the right hook or time to do this.
after and afterEach don't work - I don't think the test report has saved the file yet.
Using a plugin, hooking to some event on test:before:run or test:after:run seem promising, but I'm flying blind since I can't debug into it, so I've been unsucessful in modifying the reporter's output path or copying the file.
I'd love it if someone could show a working example using mocha-junit-reporter, or even a different mocha compatible reporter, if the reporter would play well with Azure Dev Ops, and can help me discover intermittently failing tests.

Get GitLab "my projects" tab as JSON or XML?

Is it possible to get serialized output of some sort from the /dashboard/projects screen in GitLab?
(I want to track differences and alert myself when someone assigns me a new project. One option is of course to build a script that iterates through the HTML pages, but if there's a way to get all projects at once -- preferably in a machine-friendly format -- that's even better.)
I think that usually this kind of alert are not strictly needed, because usually the assignment workflow is about issue/MR assignment (which usually end up in a email in you inbox), anyway..
You should take a look at GitLab API or, even better, use an already existing project like Python GitLab
It is a Python client implementation of GitLab API and also have an handy gitlab command line tool that can give you the required data in a human/machine readable format

How can I convert Wikitext Markup containing the double curly bracket functions, into plaintext or html?

I am creating a customized Wiki Markup parser/interpreter. There is a big task however in regards to interpreting functions like these:
{{convert|500|ft|m|0}}
which is converted like so:
500 feet (152 m)
I'd like to avoid having to manually code interpretations of these functions, and would rather employ a method where I query a string
+akiva#akiva-ThinkPad-X230:~$ wiki-to-text "convert|3|to(-)|6|ft|abbr=on}}"
and get a return of:
"3 to 6 ft (0.91–1.83 m)"
Is there a tool to do this? Offline is by far the most ideal solution, but I could live with having to query a server.
You could query the MediaWiki api to get a parsed text from wikitext. E.g. to parse the template Template:Done from the english wikipedia you could use: https://en.wikipedia.org/w/api.php?action=parse&text={{Template:done}}&title=Test (see the online docs for parse). You, however, need a MediaWiki instance that provides a template that you want to parse and which works in the exact same way. If you install a webserver locally, you can install your own MediaWiki instance and parse wikitext locally, too.
Btw.: There's the Parsoid project, too, which implements a node-based wikitext->html->wikitext parser. However, it, iirc, still needs to query the api of the wiki to parse templates.

In Cucumber-JUnit, is there a way to control the order in which features get reported?

I am running a basic Cucumber-Jvm test with two features called "Basic Math" and "Advanced Math" (in files basic_math.feature and advanced_math.feature respectively).
However, when the HTML report gets generated "Advanced Math" gets displayed before "Basic Math", whereas I would like "Basic Math" to appear before "Advanced Math". This is not trivial since if I can organise the output more logically, then the reports will be more accessible to our business analysts and QA department and the more traction I will be able to get.
I know I could try to do some sort of XSLT post processing with a Maven plugin, but I'm looking for someway to define it in code using annotations. Is there such a way? Cucumber.#Options.features actually defines the .feature file locations, and Cucumber.#Options.name is for rexexps that determine which features get run.
Here's what I have observed. Cucumber picks up feature files for execution in sorted order.
If you can name your feature files so that basic_math is picked up first, say, rename feature files as 01basic_math.feature and 02advanced_math.feature, then the report will show basic_math tests first.