I'm trying to load a list that is returned from an API into a Jenkins parameter. For this I'm using uno-choice plugin and executing a Groovy script, because I want the parameter to appear depending on other existing parameters of the Jenkins job.
I have seen other plugins like http-request and rest-list-parameter but they don't work for me because the API response depends of the other parameters in the Jenkins job.
I have tested the solutions provided here and I was able to achieve what I wanted with sandbox deactivated when testing locally, but the Jenkins that my team uses has the sandbox activated and when I try to run the script again it fails without information or saying:
Failed to evaluate script: Scripts not permitted to use staticMethod
Requesting my company to allow me to run the script is not a solution either.
Is it possible to call an API from groovy scripts with the sandbox activated?
Related
I have an automated Jenkins workflow that runs and tests a java project. I need to get all the data and results that are outputted by Jenkins into Report Portal (RP).
Initially, I was under the impression that you have to install the ReportPortal.io Jenkins plugin to be able to configure Jenkins to communicate with RP.
However, it appears that the plugin will eventually be deprecated.
According to one of the RP devs, there are APIs that can be used, but investigating them on our RP server does not give very clear instructions on what every API does or if it is what is required to get test data from Jenkins to RP.
How then do I get Jenkins to send all generated data to RP?
I am very familiar with Jenkins, but I am extremely new to Report Portal.
ReportPortal is intended for test execution results collection, not for jenkins logs gathering.
In two words, you need to find reporting agent at their github organization which depends on your testing framework (e.g. junit, testng, jbehave) and integrate it into your project.
Here is example for TestNG framework:
https://github.com/reportportal/example-java-TestNG/
Context
I use poll policy to get the result of a build. But I want jenkins automatically push the result to me.
How to configure a job to call a http api after its build has completed?
For example, after a build has completed, jenkins call https://{myserver}/api/v1/jenkinsPostBuildCallback?jobName=name&buildNumber=1&result=Failed
Current Attempt
I want to achieve this using jenkins plugins, but I find no plugin that meet my requirement.
Maybe I should develop a custom jenkins plugin?
In the post build select execute shell command and add a curl command to call your http api.
I have instances of Jenkins and GitLab which are successfully connected. Part of setting up the GitLab plug-in involves providing an API token. I believe this is used by the plug-in to get details of the commit which is triggering a job.
I need to run a daily Jenkins job which collects some statistics using the API and then (using R) generates a report. So this is not triggered by an event in GitLab.
To complicate issues a little further, the R code will run inside a container (to avoid hving to install R and all the packages on every Jenkins slave),
It does not appear that the plug-in makes the token available to be used in jobs ... and I can see a sane reason for that.
Is it possible to access the API token from the plug-in?
There is a plugin which supports credential injecting (https://wiki.jenkins.io/display/JENKINS/Credentials+Binding+Plugin) to the builds which could be used later as an environment variable. Gitlab api token could be also selected.
Developed few scripts using GATLING tool
Able to execute those scripts as a standalone basis
Execution done through GATLING provided .bat file
Triggering of the batch file will ask for user inputs during run time to
select which scenario to simulate
Trying to integrate these scripts and trigger via JENKINS -
As parameterizing the argument does not support the GATLING provided bat
file
Configuring the GATLING provided bat file results in failure of build -
as it requires a user input during run time
Please anyone can provide a step wise approach to integrate GATLING scripts in JENKINS
Gatling support passing parameter : http://gatling.io/docs/current/cookbook/passing_parameters/
Gatling seems a Java tool and execute script by a .bat/.sh file, so that you can inspect what command and parameters it used in backgounnd sence with some tool's help. like 'processhacker' is a enhancement of Windows Task Management. with it you can see the whole command to help you find out how to pass scenario you want to run in command line. If 'processhacker' can't help that, you need to read the souce code of Gatling or send support mail to its company to ask help.
I have a gradle tasks that deploys some stuff to bintray using curl.
For this to work it needs my bintray api key. I don't want to put that in my build script (or a property file) since all this stuff is hosted in plain sight at github.
Instead I made the task use a property named bintrayApikey which is to be provided when calling gradle. When I run it locally using
gradlew pushToBintray -DbintrayApikey=<my api key>
everything works as intended.
So the next step is to make this work from my Jenkins over at cloudbees. Since there doesn't seem to be a special place for putting system properties I just added them to the tasks, but this does not seem to work. In the console I can see it is accessing bintray all right, but then finishes with:
This resource requires authentication
So how can I provide the property value in my jenkins job configuration?
Use -Pmyprop instead of -Dmyprop.
The Gradle Jenkins Plugin accepts parameters with -P.
-D is for java parameters.