[ 
https://issues.jenkins-ci.org/browse/JENKINS-13631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=162616#comment-162616
 ] 

Thomas Lehmann edited comment on JENKINS-13631 at 5/11/12 12:27 PM:
--------------------------------------------------------------------

I guess I realize what the problem is (however I am not familar with 
Jenkins/Hudson nor with the promote plugin).
The passed job name is "NAME-OF-THE-JOB". I've debugged the calls and tried to 
reverse engineer what Jenkins.getItem() does. After that I've tried to pass 
"/NAME-OF-THE-JOB". It dit not fail with an exception and responded with 200 
OK. After that the promotion was marked approved. So I think this did the 
trick. Even though I do not know if this is correct. :)

Bad request:
$ curl -X POST --cookie "JSESSIONID.*****; JSESSIONID.*****" --form-string 
'_.=NAME-OF-THE-USER' --form-string 'json={"": "NAME-OF-THE-USER"}' 
--form-string 'Submit=Approve'  
'http://localhost:8070/job/NAME-OF-THE-BUILD/9/promotion/promotionProcess/Release%20Approved/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve?job=NAME-OF-THE-BUILD&buildNumber=9&promotion=Release%20Approved'

Good request:
$ curl -X POST --cookie "JSESSIONID.*****; JSESSIONID.*****" --form-string 
'_.=NAME-OF-THE-USER' --form-string 'json={"": "NAME-OF-THE-USER"}' 
--form-string 'Submit=Approve' 
'http://localhost:8070/job/NAME-OF-THE-BUILD/9/promotion/promotionProcess/Release%20Approved/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve?job=/NAME-OF-THE-BUILD&buildNumber=9&promotion=Release%20Approved'

As this works for me I'll write a Greasemonkey script to workaround this by 
patching the formular.

Please give me feedback if the missing slash prefix is the error.

Edit: changed job name to a capitalized "variable"
                
      was (Author: tholewebgods):
    I guess I realize what the problem is (however I am not familar with 
Jenkins/Hudson nor with the promote plugin).
The passed job name is "NAME-OF-THE-JOB". I've debugged the calls and tried to 
reverse engineer what Jenkins.getItem() does. After that I've tried to pass 
"/NAME-OF-THE-JOB". It dit not fail with an exception and responded with 200 
OK. After that the promotion was marked approved. So I think this did the 
trick. Even though I do not know if this is correct. :)

Bad request:
$ curl -X POST --cookie "JSESSIONID.*****; JSESSIONID.*****" --form-string 
'_.=NAME-OF-THE-USER' --form-string 'json={"": "NAME-OF-THE-USER"}' 
--form-string 'Submit=Approve'  
'http://localhost:8070/job/Build-1/9/promotion/promotionProcess/Release%20Approved/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve?job=Build-1&buildNumber=9&promotion=Release%20Approved'

Good request:
$ curl -X POST --cookie "JSESSIONID.*****; JSESSIONID.*****" --form-string 
'_.=NAME-OF-THE-USER' --form-string 'json={"": "NAME-OF-THE-USER"}' 
--form-string 'Submit=Approve' 
'http://localhost:8070/job/Build-1/9/promotion/promotionProcess/Release%20Approved/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve?job=/Build-1&buildNumber=9&promotion=Release%20Approved'

As this works for me I'll write a Greasemonkey script to workaround this by 
patching the formular.

Please give me feedback if the missing slash prefix is the error.
                  
> Can't manually promote build with approval parameter
> ----------------------------------------------------
>
>                 Key: JENKINS-13631
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13631
>             Project: Jenkins
>          Issue Type: Bug
>          Components: promoted-builds
>    Affects Versions: current
>         Environment: debian 5
> Oracle JDK 1.6.0_12
> Jenkins 1.461
>            Reporter: Aurélien Pelletier
>              Labels: plugin
>         Attachments: fix-missing-slash-in-job-name.user.js
>
>
> Promoted build plugin version 2.5, it works with version 2.4
> I have a job configured with a manually approved + approval parameter 
> promotion.
> When I try to promoted the build using the "Approve" button to pass the 
> parameters I get an error 500 with this stack trace:
> java.lang.IllegalArgumentException: THE_NAME_OF_THE_JENKINS_JOB
>     at hudson.maven.ModuleName.fromString(ModuleName.java:97)
>     at hudson.maven.MavenModuleSet.getItem(MavenModuleSet.java:354)
>     at hudson.maven.MavenModuleSet.getItem(MavenModuleSet.java:117)
>     at jenkins.model.Jenkins.getItem(Jenkins.java:2159)
>     at jenkins.model.Jenkins.getItem(Jenkins.java:2180)
>     at 
> hudson.plugins.promoted_builds.conditions.ManualCondition.doApprove(ManualCondition.java:148)
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to