jenkinsci / artifact-repository-parameter-plugin

Display information from an artifact repository as Jenkins build parameters.
https://plugins.jenkins.io/artifact-repository-parameter/
MIT License
0 stars 9 forks source link

Change in search query string for Nexus #11

Closed theyoz closed 1 year ago

theyoz commented 2 years ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Hi,

Environment below.

Somewhere between Nexus 3.16.1 and 3.37.1 the search string the token name for the following URL is not returning anything

3.16.1 /service/rest/v1/search?name=openesb-se&repository=maven-releases

3.37.1 /service/rest/v1/search?maven.artifactId=openesb-se&repository=maven-releases

The name or group must be replaced by maven.artifactId and maven.groupId respectively.

The workaround using Apache reverse proxy is

`

HACK JENKINS

RewriteEngine On

    RewriteCond %{QUERY_STRING} ^(.*)name(.*)$

    RewriteRule ^(.*)$ $1?%1maven.artifactId%2 [R=301,L]

    RewriteCond %{QUERY_STRING} ^(.*)group=(.*)$

    RewriteRule ^(.*)$ $1?%1maven.groupId=%2 [R=301,L]

`

Otherwise the combobox with version is empty


Jenkins: 2.319.1 OS: Linux - 4.9.118-xxxx-std-ipv6-64

ace-editor:1.1 ant:1.13 antisamy-markup-formatter:2.1 apache-httpcomponents-client-4-api:4.5.13-1.0 artifact-repository-parameter:1.0.1 artifactory:3.15.4 bitbucket:214.v2fd4234d0554 bootstrap4-api:4.6.0-3 bootstrap5-api:5.1.3-4 bouncycastle-api:2.25 branch-api:2.7.0 build-name-setter:2.2.0 build-timeout:1.20 build-user-vars-plugin:1.8 caffeine-api:2.9.2-29.v717aac953ff3 checks-api:1.7.2 cloudbees-folder:6.17 command-launcher:1.6 config-file-provider:3.9.0 credentials:1074.v60e6c29b_b44b credentials-binding:1.27.1 display-url-api:2.3.5 durable-task:493.v195aefbb0ff2 echarts-api:5.2.2-2 email-ext:2.87 extensible-choice-parameter:1.8.0 font-awesome-api:5.15.4-5 git:4.10.3 git-client:3.11.0 git-parameter:0.9.15 git-server:1.10 github:1.34.1 github-api:1.122 github-branch-source:2.9.5 gradle:1.38 h2-api:1.4.199 handlebars:3.0.8 ivy:2.1 jackson2-api:2.13.1-246.va8a9f3eaf46a javadoc:217.v905b_86277a2a javax-activation-api:1.2.0-2 javax-mail-api:1.6.2-5 jaxb:2.3.0.1 jdk-tool:1.5 jjwt-api:0.11.2-8.82737cbfa6f5 jquery:1.12.4-1 jquery3-api:3.6.0-2 jsch:0.1.55.2 junit:1.54 junit-attachments:1.7 ldap:1.26 lockable-resources:2.10 mailer:408.vd726a_1130320 matrix-auth:2.6.6 matrix-project:1.20 maven-artifact-choicelistprovider:1.9.0 maven-plugin:3.16 mercurial:2.12 momentjs:1.1.1 nexus-artifact-uploader:2.13 okhttp-api:4.9.3-105.vb96869f8ac3a pam-auth:1.6 pipeline-build-step:2.15 pipeline-github-lib:1.0 pipeline-graph-analysis:188.v3a01e7973f2c pipeline-input-step:446.vf27b_0b_83500e pipeline-maven:3.10.0 pipeline-milestone-step:100.v60a_03cd446e1 pipeline-model-api:1.9.3 pipeline-model-definition:1.9.3 pipeline-model-extensions:1.9.3 pipeline-rest-api:2.21 pipeline-stage-step:291.vf0a8a7aeeb50 pipeline-stage-tags-metadata:1.9.3 pipeline-stage-view:2.21 pipeline-utility-steps:2.12.0 plain-credentials:1.8 plugin-util-api:2.13.0 popper-api:1.16.1-2 popper2-api:2.11.0-1 resource-disposer:0.17 run-condition:1.5 saml:2.1.1-275.va_5718591a_999 scm-api:595.vd5a_df5eb_0e39 script-security:1131.v8b_b_5eda_c328e snakeyaml-api:1.29.1 ssh-credentials:1.19 ssh-slaves:1.31.5 sshd:3.1.0 structs:308.v852b473a2b8c timestamper:1.11.8 token-macro:267.vcdaea6462991 trilead-api:1.0.13 versionnumber:1.9 workflow-aggregator:2.6 workflow-api:1136.v7f5f1759dc16 workflow-basic-steps:2.24 workflow-cps:2648.va9433432b33c workflow-cps-global-lib:552.vd9cc05b8a2e1 workflow-durable-task-step:1121.va_65b_d2701486 workflow-job:1145.v7f2433caa07f workflow-multibranch:706.vd43c65dec013 workflow-scm-step:2.13 workflow-step-api:622.vb_8e7c15bc95a workflow-support:813.vb_d7c3d2984a_0 ws-cleanup:0.40

Reproduction steps

create a build parameter for artifact version

Expected Results

Get the version from nexus search

Actual Results

empty

Anything else?

No response

frieder commented 2 years ago

Hi @theyoz , thank you for letting me know. I'll have a look at this shortly.

frieder commented 2 years ago

@theyoz Sorry it took me so long to finally address the issue.

I just tested the issue locally against Nexus OSS 3.42.0-01 and cannot reproduce it. Next I had a look at how I'm requesting the information from Nexus and compared it to the API documentation available at https://help.sonatype.com/repomanager3/integrations/rest-and-integration-api/search-api as well as the local Swagger/OpenAPI documentation built into Nexus (/#admin/system/api) and it seems that name is still a valid URL parameter and my requests should be valid.

nexus1 nexus2

You didn't write anything about whether you are using the commercial or OSS version of Nexus. I don't have access to a commercial version of Nexus so I cannot check if there are differences in the APIs of these two versions. I'd assume the APIs are the same but you never know. ;)

Can you please elaborate on why you would need maven.artifactId and cannot work with the more generic name parameter? The idea to use the generic name parameter was because with the artifact path option people do not specify what kind of resources they are interested in hence I don't know whether I should search for a Maven, npm, Python or whatever artifact. So using maven.artifactId instead of name would effectively block any non-Maven artifact from ever being found.

So it would be interesting to hear what is your use-case and what exactly prevents you from using the name argument as it is implemented today.

Thank you for your help Frieder

frieder commented 1 year ago

Since there has been no activity on this ticket for a while I'll close this ticket. If you believe this is still an issue please re-open the ticket and provide additional information.