archiver/publisher for external artifact URL - jenkins

I'm generating a presigned S3 URL as part of a workflow job, which is passed into a build step that essentially runs outside of the workspace (via ssh). I've been unable to identify an existing publish or archive plugin (workflow compatible or not) that will allow setting an external URL. Is there a plugin or workaround that enables setting a URL as an artifact or the addition of simple metadata to the build results?
I'm a bit surprised that there isn't a way to publish metadata directly from a workflow -- it seems like this would be insanely useful functionally. Have I missed something obvious?

JENKINS-26918 proposes support for some of the features in the Groovy Postbuild plugin. Using core Workflow, you can call
currentBuild.description = "Published"
(or whatever your installation’s markup formatter allows).

Related

Jenkins Pipeline parameter: list of available git repositories

I'd like to create a pipeline, where one of the parameters is a git repository from a list of available repositories. The list would be similar to the one you see when creating a multibranch pipeline with a bitbucket repository.
Is there a plugin that can do this? Is it hard to make one for myself?
I shoild think the relatively new REST List Parameter would work in these circumstances, as long as the repository host supports the plugin authentication mechanisms. It's kind of an HTTP Request extension for Build with Parameters plugin.
Plugin author (not me) is very responsive to positive feeback and useful enhancement requests.

Is there a way to track usage of a global shared library in Jenkins?

Context:
At my work most developers are free to write their own Jenkinsfile for their own team's projects.
As the Jenkins admin, I provide developers with a global shared library.
Most projects are using either v1 or v2 or v3 or another version of this library, using the idiom library("theSharedLib#v#").
Question: Is there a way for me to find out which Jenkinsfile is using which version of the shared library without having to actually lookup into all those Jenkinsfile files (50+ files in as much git repos)?
What I would see best is some mechanism that write up (into a file on the Jenkins master or in a DB) which project/Jenkinsfile is using which version at the time the library is loaded.
A possible solution would be to add some code to every function inside the library that will actually do this reporting. I could then see which function is used by who. Any better solution?
I wrote https://github.com/CiscoDevNet/es-logger to gather information such as this from Jenkins. It has a plugin that will run a regex against the console log of a completed job and can then post events to elastic search.
Jenkins helpfully posts library loads at the start of the log such as:
Loading library sharedLib#version
So a simple regex like
"^Loading library\S+(?P<library_name>.*?)#(?P<library_version>.*?)\S+$"
added to the console_log_events plugin would generate events in an elastic search for each usage and each version.

How to instruct Jenkins to look for email template in user defined path (OTHER THAN $JENKINS_HOME/email-templates)

I have groovy email template(for Selenium Robot framework test execution) for Jenkins. Jenkins master is controlled by a remote team. So for placing this template in $JENKINS_HOME/email-templates, we need to raise a ticket and wait from 2 to 3 days. Also we expect, there might be changes required in template. So we are planning to put our templates inside our source code repository (GIT). so in the Jenkins test job, we checkout the test script together with email templates.
How to instruct Jenkins to look for the template in workspace folder instead of $JENKINS_HOME/email-templates in Jenkins Master
Sadly it seems you would need to modify the email-ext plugin as the search path is hardcoded into it.
You can see it here, check the occurrence on line 69 in file src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
Changing it to another path would be trivial, however adding multiple locations you'd probably have to put some work in.
Edit: I wonder if it would be possible to put the wanted stuff into some txt file as a build step, and then load it into the mail content via some template configuration. If you have access to the job configuration this might be worth checking.
You can copy the template into the build workspace (e.g. with SCM step), and then email-ext can reach it:
${SCRIPT, template="${WORKSPACE}/foo.template"}

Nexus url of ivy (ant) publish task

When using the Ivy:publish (ant)task, is there some reliable way to retrieve the URL of the published artifact.
The reason we like to know this is because we build the artifact on jenkins and would like to link the 2 processes together so we know which build produced a specific artifact. since we trigger builds fairly often and in parralel just getting the url of the last published artifact is unreliable.
You can retrieve the exact URL of the snapshot by using the REST API:
https://support.sonatype.com/entries/23674267-How-can-I-retrieve-a-snapshot-if-I-don-t-know-the-exact-filename-

Configure the ext-mail of hudson

I have a grails project and I use hudson to follow different analysis. I want to send the report analysis (cobertura, codenarc, findbug) to the developer. However, I don't know how to use hudson's ext-mail. Through googling I suspect the solution is to use jelly sscript but I can seem to get it to work.
If the default jelly templates don't have everything you need in them, you can customize them without much effort.
Grab a copy of the default template: Default Jelly Templates
Modify it as needed
Place a copy in JENKINS_HOME\email-templates (create the dir if needed)
Configure the build to utilize the new template. If your new script is ensienne.jelly, the email content would look like this ${JELLY_SCRIPT,template="ensienne"}.
Side Note: Hudson was renamed to Jenkins a while back.
Also, here is a good resource for the email-ext plugin: Email-ext wiki

Resources