Giter VIP home page Giter VIP logo

rest-list-parameter-plugin's Introduction

REST-List Parameter Plugin

icon CodeFactor Grade rest list parameter plugin 2024 contributions welcome green
rest list parameter plugin rest list parameter rest list parameter plugin

Introduction

This Plugin provides parameter type that can request a REST endpoint and offer a list of values parsed from the response value at build start time. The REST responses may contain Json or XML, which can be parsed with Json-Path and xPath respectively. If the REST endpoint requires authentication, then either Basic or Bearer authentication can be used.

Changelog

Release notes can be found in the GitHub Releases

Features

  • Specify any REST/Web endpoint that returns either a Json or XML response with values to select from for a build

  • Authenticate against the endpoint if required (either with BASIC or BEARER authentication)

  • Filter/Pars the values of the web response with Json-Path or xPath (depending on MIME type)

  • Set a per-selected default value (as long as that value is within the received value list)

  • User-friendly error communication

  • Response value caching

  • Advanced configuration validation

  • Optional value post processing

    • Filter the already parsed values via a REGEX

    • Apply a sort order to the values

Configuration

Parameter configuration (Advanced collapsed)
Parameter configuration (Advanced expanded)
Demo Build with Parameters
Demo Build with Parameters with error

Json-Path configuration

Demo config for Json-Path

If you expect the response of the specified endpoint to produce a Json response and need to utilize Json-Path, then you have to set the MIME type to APPLICATION_JSON (this will also send this MIME as ACCEPT header) and provide the desired Json-Path in the Value Expression field.

The result of such a configuration will be the application of the Json-Path on the response Json to pars the string values later provided in the Build with Parameter dropdown of this parameter.

Display value configuration

Note
Added in v1.5.x thanks to rolaca11
Demo Display Expression configuration

The optional 'display value' configuration, hidden within the advanced configuration, allows the use of a REST service that returns full Json objects that get pased into the Pipeline run but to display only an identifying value within the select dropdown.

Example JSON returned by REST endpoint
[
  {
    "name": "v10.7.7",
    "zipball_url": "https://api.github.com/repos/jellyfin/jellyfin/zipball/v10.7.7",
    "tarball_url": "https://api.github.com/repos/jellyfin/jellyfin/tarball/v10.7.7",
    "commit": {
      "sha": "53186c766bddf954483d7b40e385b382eabd0d8e",
      "url": "https://api.github.com/repos/jellyfin/jellyfin/commits/53186c766bddf954483d7b40e385b382eabd0d8e"
    },
    "node_id": "MDM6UmVmMTYxMDEyMDE5OnJlZnMvdGFncy92MTAuNi40"
  },
  {
    "...": "..."
  }
]

With a Value Expression such as $.* and a Display Expression such as $.name the values in the dropdown would only show up as the name property of each JSON object (i.e. v10.7.7).

xPath configuration

Important
If you are a user of this functionality please have a look at the pined issue #99
Demo config for xPath

If you expect the response of the specified endpoint to produce an XML response and need to utilize xPath, then you have to set the MIME type to APPLICATION_XML (this will also send this MIME as ACCEPT header) and provide the desired xPath in the Value Expression field.

The result of such a configuration will be the application of the xPath on the response XML to pars the string values later provided in the Build with Parameter dropdown of this parameter.

Authentication configuration

Depending on the authentication requirement for the REST/Web endpoint there are three supported methods:

  • NONE if there is no authentication requirement simply don’t select any Credential ID

  • BASIC if this authentication type is required, then simply select any Username and Password credential in the Credential ID field

  • BEARER if this authentication type is required, then simply select any Secret Text credential in the Credential ID field

Important
The Authentication header will be build and added based on the type of the selected credential type.

Parameter Config Validation

Note
Added in v1.1.0

The configuration page of this plugin features supportive form validation (which was already present in a basic form in v1.0.x). With v1.1.x+ the validation got expanded to be more helpful and prevent the constant switch from the configuration to a build and back, just to validate the configuration. The most notable expansion in validation was the REST Endpoint field validation, which now works similar to the validation found for the SCM fields (Endpoint and credential). Additionally, a Test Configuration button got added, which once pressed, attempts to query the endpoint and list the number of parsed values as well as the first value in the list.

Successful Configuiration Validation
Faild Configuiration Validation (due to filter)
Faild Configuiration Validation (due to json-path)

Value Caching

Note
Added in v1.2.0

The ability to use value caching allows for great performance improvements in cases of repetitive building and querying the same REST endpoints. Additionally, it drastically decreases the amount of endpoint queries, which is especially useful for rate limited endpoints. Per default caching is disabled for new and old REST List Parameter, but can be activated at any time by setting how many minutes the values should stay cached for.

Additionally, there are global configuration values now, that give the user control over the global cache size (default 50 MiB), as well as the default value for the cache max age (default 0 minutes). These values can be overwritten within the UI or via the ConfigurationAsCode plugin and applying a config with this added.

Global Config

Optional Value Ordering

Note
Added in v1.2.0

This option in the "Advanced" section of the parameter configuration allows the user to apply a sort order on the values received from the endpoint specified. The default value of this option is NONE, so no additional sporting gets applied on the values received. The other two options offer tha ability to apply either an ascending or descending sort order to the received values.

AdvancedOption

Definition in Pipeline

pipeline {
  agent any
  parameters {
    RESTList(
      name: 'REST_VALUE',
      description: '',
      restEndpoint: 'http://test.lan',
      credentialId: '',
      mimeType: 'APPLICATION_JSON',
      valueExpression: '$.*',
      cacheTime: 10,    // optional
      defaultValue: '', // optional
      filter: '.*',     // optional
      valueOrder: 'ASC' // optional
    )
  }

  stages {
    stage('Test') {
      steps {
        println env.REST_VALUE
      }
    }
  }
}

Definition in JobDsl

pipelineJob('DemoJob') {
  parameters {
    RESTList {
      name('REST_VALUE')
      description('TEST')
      restEndpoint('http://test.lan')
      credentialId('credID')
      mimeType('APPLICATION_JSON')
      valueExpression('$.*')
      cacheTime(10)       // optional
      defaultValue('')    // optional
      filter('.*')        // optional
      valueOrder('NONE')  // optional
    }
  }
  definition {
    cps {
      script("""
        pipeline {
            agent any

            stages {
                stage('Test') {
                    steps {
                        println env.REST_VALUE
                    }
                }
            }
        }
      """)
      sandbox()
    }
  }
}

Set Global Options via JCasC

unclassified:
  # ...
  restListParam:
    cacheSize: 50 # in mebibyte, needs to be greater than 0
    cacheTime: 0  # in minutes, 0 => per default don't use cache
  # ...

Contributing

I welcome all contributions and pull requests! If you have a larger feature in mind please open an issue, so we can discuss the implementation before you start.

Note
I prefer GitHub Issues over Jira Issues, but I check both regularly.

For further contributing info please have a look at the JenkinsCI contribution guidelines.

Licence

gplv3 or later

Just if the badge from shields.io and the LICENSE file do not make it obvious enough, this project is licenced under the GPLv3 or later.

Bundled Project Sources

Note
Bundled as of v1.3.x, updated as of v1.4.x
Project Version Licence Description

Select2-Bootstrap4-Theme

v1.5.2

MIT

A CSS theme for Select2, when used in Bootstrap4 apps

Development

Requirements

  • Java 8 or newer

  • Maven 3 or newer

  • (optional) a test Jenkins instance to deploy the plugin SNAPSHOT to for testing

Build

$ # build, test and package to hpi (hpi can be deployed to test Jenkins)
$ mvn -B package --file pom.xml
$ # build, test, package and launch test Jenkins
$ mvn -B hpi:run --file pom.xml

Release a new Version

Note
This Plugin uses SemVer to version its releases

To creat a new release follow the instruction found for the Incremental tools to create a release whilst incrementing the correct position of the SemVer.

rest-list-parameter-plugin's People

Contributors

daniel-beck avatar dependabot[bot] avatar h1dden-da3m0n avatar k3rnelpan1c-dev avatar kristofmoens avatar markewaite avatar meabed avatar rolaca11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rest-list-parameter-plugin's Issues

Whats Next?

Context

I haven had the most time to spend on this Plugin lately (evident in #85), however the time I had and spent made me realize one thing. Despite my best efforts at keeping the comparability to XML REST services once #85 is merged there will be a whole functionality branch not working due to limitations of the default xPath (as far as I was able to debug).

With that said I want to announce officially that I will be deprecating the comparability of this Plugin to XML responses with the next major version (i.e. 2.0.0).

Immediate Future

So what does that mean if you are using this Plugin to interface with XML REST endpoints?

Not much, I am planing to push at least 2 more 'minor' versions before calling it 2.0.0 and remove the XML aspect of this plugin.

Can I protest?

Well this is a Open Source Plugin, of course you can and you should let me know what you think of this planed change!
Additionally, you can bring up good reasons as to why I should keep XML in!
However, if there isn't a solid enough reason or a XML wizard steps in and wants to maintain the XML branch of this plugin then it will end as planed with 2.0.0.

Planed Releases

  • 1.5.x - will include the changes found in #85 (thank you again for your contribution @rolaca11)
  • 1.6.x - will (finally) bring pagination support (both Link Pagination according to RFC5988 as well as offset pagination via Continuation Token are planed for now)
  • 1.7.x - optional maintenance release (if it happens the final release with XML support, otherwise 1.6.x will be the final XML support release)
  • 2.0.0 - XML support removed (likely around the start of 2022)
  • next?

Final Words

I am sorry for everyone who is affected by this change, but I simply can't find the motivation and time to support XML based REST in 2021.
This is a bit of a selfish move, but unless someone steps up and wants to fix/maintain the XML side this is how things are planed for now.

[FEATURE] Display choice one way and pass as variable in another way

Is your feature request related to a problem? Please describe.
In my REST API I receive a list of JSON objects, of which I need multiple properties. Currently, if I want this option, I have to have the option appear as a JSON string.

Describe the solution you'd like
I'd like the option for this JSON object to appear not as a JSON string, but for example the name property of that object. So if the response from my API is:

[
  {
    "name": "My name",
    "age": 10,
    "profession": "dev"
  },
  {
    "name": "Other name",
    "age": 12,
    "profession": "dr"
  },

If I select the 1st option, I'd like my parameter value to be

  {
    "name": "My name",
    "age": 10,
    "profession": "dev"
  }

I'd also like the options displayed as "My name" and "Other name", or maybe even "My name, 10" and "Other name, 12".

Describe alternatives you've considered
Extend the JSONPath expression logic to allow concatenation of multiple properties. This way, I can patch together the data I need in my pipeline, like "name|age|profession", which then I can split in the pipeline.

[FEATURE] Replace Integration Tests with Unit Tests

Is your feature request related to a problem? Please describe.

Since 5b60dad failed the integration-tests due to using dynamic data (whatever I was thinking creating them this way 🤦‍♂️) I had to push ac77a7a just to make the tests pass again.

Describe the solution you'd like

Replace the iteration-tests with proper unit-tests.

Describe alternatives you've considered

remove the offending tests, yet that is not a solution -.-

Additional context

N/A

[FEATURE] Allow for easy SSL/TLS cert validation skip

Is your feature request related to a problem? Please describe.

Since a sizable amount of companies use self signed certificates for internal services and those services may be the REST endpoint to ping, it would be great to offer a simple bool flag to disable SSL/TLS verification as an alternative to importing the certificates in the Java truststore.

Describe the solution you'd like

Add a bool flag (a checkbox in the advanced UI) to skip the SSL/TLS verification for the REST call.

Describe alternatives you've considered

A very detailed documentation of how to import selfsigned certificates into the Java truststore and avoid disableing SSL/TLS verification. (not really a alternative IMHO)

Additional context

N/A

[FEATURE] Multiple choice

Is your feature request related to a problem? Please describe.
Be able to select multiple choices

Describe the solution you'd like
An checkbox option in the configuration to set the select input as singular or multiple choice

Describe alternatives you've considered
Multiple input parameters all pointing to the same webservice but very impractical

Additional context
None

[BUG] Odd invalid value behaviour when used in combination with the Parametrized Scheduler plugin

I have a puzzling issue when combining this plugin with https://plugins.jenkins.io/parameterized-scheduler/.

When I configure a schedule that passes a valid(!) value of a rest-list parameter I'm getting:

java.lang.IllegalArgumentException: Illegal value for parameter META_VERSION: 3.0.0.3
   at io.jenkins.plugins.restlistparam.RestListParameterDefinition.checkValue(RestListParameterDefinition.java:242)
   at io.jenkins.plugins.restlistparam.RestListParameterDefinition.createValue(RestListParameterDefinition.java:226)
   at hudson.model.SimpleParameterDefinition.createValue(SimpleParameterDefinition.java:41)
   at org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger.configurePropertyValues(ParameterizedTimerTrigger.java:65)
   at org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger.lambda$checkCronTabsAndRun$0(ParameterizedTimerTrigger.java:85)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger.checkCronTabsAndRun(ParameterizedTimerTrigger.java:83)
   at org.jenkinsci.plugins.parameterizedscheduler.Cron.checkTriggers(Cron.java:52)
   at org.jenkinsci.plugins.parameterizedscheduler.Cron.doRun(Cron.java:40)
   at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:92)
   at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:67)
   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
   at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
   at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at java.base/java.lang.Thread.run(Thread.java:829)

(3.0.0.3 is a valid value in this example, META_VERSION ist the parameter name)

After some trial and error I found out that I have to open the "Build with parameters" page of the job at least once manually to get the value accepted.
It's as if the allowed values are populated lazily and are not there yet when the plugin is invoked like this: https://github.com/jenkinsci/parameterized-scheduler-plugin/blob/master/src/main/java/org/jenkinsci/plugins/parameterizedscheduler/ParameterizedTimerTrigger.java#L63-L65

Does that make any sense?

[FEATURE] add option to follow links on paged JSON API responses

Is your feature request related to a problem? Please describe.

Not really, but I today notices that GitHub paginates most of its API responses and has a hard limit to 100 items per page.
This then lead to me discovering that I failed to think of this kind of situation and the logic as it is now not following the link header. 😅

(unrelated, but I also noticed that the REST API of GH does not allow for server side filtering of values 😞 )

Describe the solution you'd like

If a API returns with a link header to the next page of values follow it and collect ALL values of the API response.

Describe alternatives you've considered

well there are none I can think of 🤔

Additional context

n/a

[BUG] v1.0.0 cannot use credentials

Describe the bug
The Authorization header built by the plugin is malformed and therefor authorization against any endpoint will always fail.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a RLP with an endpoint that requires Authorizarion
  2. Select a valid credential for that endpoint
  3. result 403 (404 in the case of the GH api -.-)

Expected behavior
Proper authentication and value retrivale.

Versions (please complete the following information):

  • Jenkins: 2.249.1
  • Plugin: v1.0.0
  • Browser: any

[BUG] RestListParameterValue Not Exported To Remote Access API

Describe the bug
The value for a RestListParameterValue Parameter is missing in Remote Access API ("../api/") responses. The parameter 'name' is shown but no 'value' element is present.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a project to use a RestListParameter parameter.
  2. Generate a run/Build the project.
  3. Check the Remote Access API response (<jenkins_url>/<project>/<build#>/api/xml , <jenkins_url>/<project>/<build#>/api/json, etc.)
  4. Note the absence of a value in the response.

Expected behavior
The value of the parameter to be exposed to API requests.

Screenshots
Excerpt from the /api/xml response for a run of an example project; note the absence of a value:
image

Versions (please complete the following information):

  • Jenkins: 2.361.4
  • Plugin: 1.6.3
  • Browser: Firefox, Chrome (any really)

Additional context
Given that the information is saved to the build.xml and is shown properly on the /parameters page, this should be an oversight(?)
Guessing now...Is it possible the issue is the fact the @Exported annotation is still on the value field rather than the getValue method? As part of #85, value was shifted to private and the value.jelly file was adjusted to use the getValue method, but the annotation was not moved/changed.

[BUG] Get error, A problem occurred while processing the request!

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Versions (please complete the following information):

  • Jenkins: [e.g. 2.249.1]
  • Plugin: [e.g. 1.0.0]
  • Browser [e.g. firefox, chrome]

Additional context
Add any other context about the problem here.

[FEATURE] Support "Safe HTML" in descriptions

Is your feature request related to a problem? Please describe.
Descriptions of other parameters like plain string parameters or boolean parameters allow "Safe HTML" when OWASP Markup Formatter Plugin is installed.
This is unfortunately not the case for this plugin, leading to html tags like <a ...> not to be rendered as expected.

Describe the solution you'd like
Support for Safe HTML in parameter description.

Describe alternatives you've considered
n/a

Additional context

https://www.jenkins.io/doc/book/security/markup-formatter


string-param


This plugin:

rest-list-parameter

[FEATURE] Validate request from configure screen

Is your feature request related to a problem? Please describe.
Unable to validate connection from Config screen.

Describe the solution you'd like
When configuring a FreeStyle job, including one that requires authentication, it would be helpful to have a "Validate" or "Test Connection" to ensure the parameters have been set correctly and the response is as expected, prior to saving the job.

When setting a Credential ID for authentication, an immediate error should display (similar to SCM Git client) if authentication fails.

Describe alternatives you've considered
The alternative is to save the job, then Build with Parameters, only to see a 4xx message or wrong data and keep fiddling back and forth.

Additional context
Refer to behavior of SCM Git client as an example.
Credential + no url == "Please enter a REST endpoint"
Bad Credential + url == "Failed to connect to ... : "
Credential + url => quiet success.

Press "Validate" button to get and display response. Not 100% how to present that, but a starting point would be SUCCESS / FAIL / No data

[FEATURE] Give the user a option to alphabetically sort values

Is your feature request related to a problem? Please describe.

This issue is meant to track any progress made on providing a option to allow the user to alphabetically sort the values returned by the REST endpoint, whilst still supporting endpoints that already return the values in order (natively or via request param).

This issue is connected and a sub task of #20

Describe the solution you'd like

A option in the "advanced" configuration of the parameter configuration allowing the user to select ordering/sorting.

  • None - Order of values is taken from the order they arrive in
  • AtoZ - Simple alphabetical order
  • ZtoA - Reverse alphabetical order

Describe alternatives you've considered

There isn't really an alternative to this functionality, besides having a REST endpoint that can be told to sort the returns values, which requires the REST endpoints support.

Additional context

N/A

Error if value in JSON is an integer instead of a string

The following error is displayed if a value is an integer:

Feb 16, 2022 3:08:03 PM WARNING hudson.init.impl.InstallUncaughtExceptionHandler handleException
Caught unhandled exception with ID 559eaa27-e8b0-4c3f-bcb9-c9bb554b3b88
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.util.List (java.lang.Integer and java.util.List are in module java.base of loader 'bootstrap')
	at io.jenkins.plugins.restlistparam.logic.ValueResolver.resolveJsonPath(ValueResolver.java:124)
	at io.jenkins.plugins.restlistparam.logic.RestValueService.convertToValuesList(RestValueService.java:243)
	at io.jenkins.plugins.restlistparam.logic.RestValueService.get(RestValueService.java:67)
	at io.jenkins.plugins.restlistparam.RestListParameterDefinition$DescriptorImpl.doTestConfiguration(RestListParameterDefinition.java:419)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:393)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)
	at org.kohsuke.stapler.SelectionInterceptedFunction$Adapter.invoke(SelectionInterceptedFunction.java:36)
	at org.kohsuke.stapler.verb.HttpVerbInterceptor.invoke(HttpVerbInterceptor.java:48)
	at org.kohsuke.stapler.SelectionInterceptedFunction.bindAndInvoke(SelectionInterceptedFunction.java:26)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:141)
	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:536)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
Caused: javax.servlet.ServletException
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:816)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:694)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:156)
	at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:153)
	at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:80)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:153)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:159)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:92)
	at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:53)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:133)
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:92)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:62)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:109)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:51)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:85)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:39)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:834)

And similar error while working with another JSON response:

Caught unhandled exception with ID 1bbf94f8-8754-44dd-b53e-fce65a16255e
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
	at io.jenkins.plugins.restlistparam.logic.ValueResolver.lambda$resolveJsonPath$1(ValueResolver.java:131)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at io.jenkins.plugins.restlistparam.logic.ValueResolver.resolveJsonPath(ValueResolver.java:133)
	at io.jenkins.plugins.restlistparam.logic.RestValueService.convertToValuesList(RestValueService.java:243)
	at io.jenkins.plugins.restlistparam.logic.RestValueService.get(RestValueService.java:67)
	at io.jenkins.plugins.restlistparam.RestListParameterDefinition$DescriptorImpl.doTestConfiguration(RestListParameterDefinition.java:419)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:393)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)
	at org.kohsuke.stapler.SelectionInterceptedFunction$Adapter.invoke(SelectionInterceptedFunction.java:36)
	at org.kohsuke.stapler.verb.HttpVerbInterceptor.invoke(HttpVerbInterceptor.java:48)
	at org.kohsuke.stapler.SelectionInterceptedFunction.bindAndInvoke(SelectionInterceptedFunction.java:26)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:141)
	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:536)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
Caused: javax.servlet.ServletException
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:816)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:694)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:156)
	at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:153)
	at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:80)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:153)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:159)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:92)
	at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:53)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:133)
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:92)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:62)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:97)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:109)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:51)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:85)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:39)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:834)

Here's a screenshot of my configuration:
Screen Shot 2022-02-16 at 3 20 25 PM

Plugin version: 1.5.1
Jenkins 2.319.1

I was hoping this was fixed in #109 but this is still occurring.

[BUG] Only Java level Web proxy settings apply

Describe the bug

For a Jenkins plugin it is to be expected that the Jenkins set web proxy should be enough to call out (if the proxy allows for that), unfortunately I missed the logic to actually account for that 😟.
Currently the only way to have the plugin work is to have the Jenkins Java war run with the Java global proxy settings.

-Dhttp.proxyHost=proxy.server.com
-Dhttp.proxyPort=80

-Dhttps.proxyHost=proxy.server.com
-Dhttps.proxyPort=80

To Reproduce

Steps to reproduce the behavior:

  1. Have your Jenkins run in a http_proxy environment
  2. create a new Job
  3. add a Rest-List-Paramert
  4. See host resolution error

Expected behavior

The plugin should respect the Jenkins configured http proxy (this can be set in the 'Manage Jenkins' > 'Plugin Manager' > 'Advanced' section)

Versions (please complete the following information):

  • Jenkins: 2.249.2
  • Plugin: 1.1.0
  • Browser: Firefox, Chrome (any really)

Additional context

N/A

RESTList not returns its value to Active Choices Reactive Parameters when it referenced

Describe the bug
Hi! The RESTList parameter returns its own description instead of the value when it used as a "referencedParameters" in an activeChoiceHtml parameter

To Reproduce
Steps to reproduce the behavior:

  1. Create a job with the RESTList parameter type and the name "RESTList_ParameterName", which returns some list of values. And write something in the description field!
  2. Create a second parameter of the type "Active Choices Reactive Reference Parameter" with the following parameters:
    activeChoiceHtml(choiceType: 'ET_FORMATTED_HTML',
    name: 'Param2',
    omitValueField: false,
    randomName: 'choice-parameter-3402384435426128',
    referencedParameters: 'RESTList_ParameterName',
    script: groovyScript(fallbackScript: [sandbox: true, script: 'return ["ERROR"]'], script: [sandbox: true, script: 'return ["${RESTList_ParameterName}"]'])
  3. Save it.
  4. Click on "Build with parameters"
  5. In the Param2 field you will see the description from the RESTList_ParameterName param.

Expected behavior
I expected to see the value but not the description of "RESTList_ParameterName" parameter.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • Jenkins: 2.426.3
  • Plugin: IDN
  • Browser chrome

Additional context
Add any other context about the problem here.

[FEATURE] Improve the usability of the actual value selection process

Is your feature request related to a problem? Please describe.

This is already helped by #21, but can be further improved by utilizing the f:combobox Jenkins UI control or a alternative.

This is related to and a sub-task of #20

Describe the solution you'd like

The user should be able to filter the values offered in the sector of the parameter (e.g. a Combo-box / editable select box).

Describe alternatives you've considered

A alternative solution could be a separate filter text-box next to the parameters select-box that can filter the values provided by the select-box.

Additional context

As I am no expert in fronted development (ESPECIALLY pure JavaScript) I can most likely only provide this functionality via the f:combobox, so any reference to a alternate solution is welcome. (some have already been provided by @ianwilliams1 here)

[BUG] Only global jenkins credentials are passed if REST/Web endpoint requires authentication

English is not my native language so i'll try to give my best explanation
If you set up your Jenkins project in folder and add credentials, that are limited to that folder, even though test configuration works successfully (https://prnt.sc/vr3grXun5SBj) trying to build it will throw 401 error (https://prnt.sc/VCivl-WW9Pdt)
If you add the same credentials globally in jenkins, it will work as expected
https://prnt.sc/i59W2TMGelVK
https://prnt.sc/tZhhvj95oDTq
and building it works with no errors
https://prnt.sc/dMABs5z1lZ5R

To Reproduce
Steps to reproduce the behavior:

  1. Go to Jenkins dashboard and create new folder
  2. Create a project in this folder
  3. Select the option "This project is parameterized" add "REST List Parameter" and fill all the fields according to your rest endpoint, make sure it requires authentication
  4. Add credentials limited to that folder (subfolder in my case, but there is no difference) https://prnt.sc/KkgWfYv0epuq
  5. Test configuration, everything will work as expected
  6. Save project and build it with parameters
  7. You will see 401 (unauthorized) error
    Expected behavior
    Credentials are applied, project builds and you receive data from your REST endpoint

Versions:

  • Jenkins: [Jenkins 2.360]
  • Plugin: [1.6.2]
  • Browser [tested in firefox, chrome, edge]

Additional context
Add any other context about the problem here.

[FEATURE] using the cached values is configurable

Is your feature request related to a problem? Please describe.
Actually, I need the latest rest api response in every build job. Not a cached value.
I think it's better to provide an option.

Describe the solution you'd like
A checkbox in configure page.

Describe alternatives you've considered
If the checkbox is checked, use the cached values, or retrieve values every time.

Additional context
None

[FEATURE] Support continuation tokens

Is your feature request related to a problem? Please describe.
When nexus responds with a list of items, the response contains a maximum of 10 items and a continuation token, if there are more items. With the current plugin capabilities, I can only get 10 items from my nexus repository.

Describe the solution you'd like
A general solution, where if a continuation token is found, the request is repeated with that continuation token.

Describe alternatives you've considered
I don't think there is a workaround, this feature is put in place as a security measure. You might want a switch that can turn the behavior off. I can see that it might cause problems.

Additional context
I found a site explaining the technique. https://phauer.com/2017/web-api-pagination-continuation-token/ From this, it seems to me that this feature is at least semi-standard in rest apis, even if it seems not to be too popular. Is there a place for a feature like this in the plugin? Is it too specific? Unfortunately, it seems like there isn't a consensus on how the API expects the continuation token. It might be some header or a query parameter.

[BUG] java.lang.Integer cannot be cast to class java.lang.String

In Jenkins we have jobs with REST List Parameter enabled and it uses our Docker Tags as REST endpoint:
Ex:
REST Endpoint: https://REPO_URL/v2/hello-world/tags/list
MIME type: APPLICATION JSON
Value Expression: $.tags
image

When manually curl the address we have as result:
{
"name" : "hello-world",
"tags" : [ "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "3", "4", "6", "7", "8", "9" ]
}

Versions (please complete the following information):

  • Jenkins: 2.319.2
  • Plugin: 1.5.0
  • Browser: Firefox or Chrome

Additional context
JENKINS ERROR:

Error while serving http://JOB_URL/descriptorByName/io.jenkins.plugins.restlistparam.RestListParameterDefinition/testConfiguration
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')

Caused: java.lang.reflect.InvocationTargetException
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)

There is other Job that it works and the JSON result is:
{
"name" : "image_name",
"tags" : [ "1.0.0-20210211101025", "1.0.0-20210211101625", "1.0.0-20210211101756", "1.0.0-20210211102118", "1.0.0-20210305142411", "1.0.0-20210309074905", "1.0.0-20210310065345", "1.0.0-20210312074331", "1.0.0-20210319065144", "1.0.0-20210324142526", "1.0.0-20210330073431", "1.0.0-20210426065757", "1.0.0-20210519113253", "1.0.0-49", "1.0.0-52", "1.0.0-53", "1.0.0-54", "1.0.0-latest" ]
}

[BUG] User scoped credentials cannot be used

Describe the bug
Scoped credentials cannot be used.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Jenkins folder and within this new folder a new scoped credential
  2. In the credential dropdown of the plugin choose the above created credential
  3. See error

Expected behavior
Scoped credentials can be used as well

Screenshots
If applicable, add screenshots to help explain your problem.
credentials_error

Versions (please complete the following information):

  • Jenkins: [2.249.1]
  • Plugin: [1.2.2]
  • Browser [firefox, chrome]

Additional context
Add any other context about the problem here.

A possible solution could look like this (not production ready code though)

import com.cloudbees.plugins.credentials.Credentials

Set<Credentials> allCredentials = new HashSet<Credentials>();

// Get credentials from the root scope
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
      com.cloudbees.plugins.credentials.Credentials.class
);

allCredentials.addAll(creds)

// Get credentials from the user scopes respectively folders
Jenkins.instance.getAllItems(com.cloudbees.hudson.plugins.folder.Folder.class).each{ folder ->
 creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
      com.cloudbees.plugins.credentials.Credentials.class, folder)
  allCredentials.addAll(creds)
}

[FEATURE] - Better presentation / easier selection of response value

Is your feature request related to a problem? Please describe.
Selecting build parameter is problematic for large responses. It very difficult to choose desired value.
Our json response is 2000+ values, the response is unordered (or "unknown" - ordered on a field other than the response field).

If many "unordered" values are returned (eg: US state names, but ordered by size), values are all over the place alphabetically in the list.
eg: Look for Missouri, typing "M" takes you to the first "M", (Massachusetts) but "M", then "I" just moves you to next "I" (Indiana). Typing "M" again takes you to next "M" (Mississippi), skipping "Maine".

Describe the solution you'd like
{really two features, but it's tied to the same issue - selectability).

User should be able to select from the drop-down OR simply start typing; matching values should filter the list.
A good example is the JIRA Search.
If I type " I should see Missouri and Mississippi to choose from.
Not sure if Jenkins UI options readily support that.
Simplest option may be change f:textbox to f:combobox ?

There should be a configuration option to provide a client-side order transformation, a "sorted" response (Asc/Desc).
If possible to apply sort as a value expression, it still complicates to combine a criteria AND a sort. Makes for easier usage for both sides as a separate option.

Describe alternatives you've considered
Tried experimenting w/Value Expression but have not figured out how to (may be my fault).

Additional context
None. Thanks for your efforts and consideration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.