Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63786

Expose live choices to the remote API (for programmatic consumption)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition#getChoiceList

      should be @Exported in order to get the choiceList in Remote Access API.

       It allows programs retrieve choices in this way, with Remote Access API (https://www.jenkins.io/doc/book/using/remote-access-api/):

      $ curl --user username:password <JENKINS_URL>/job/<JOB_NAME>/api/json
      {
        "_class": "hudson.model.FreeStyleProject",
        ...
        "description": "",
        "displayName": "job1",
        "displayNameOrNull": null,
        "fullDisplayName": "job1",
        "fullName": "job1",
        "name": "job1",
        ...
        "property": [
          {
            "_class": "hudson.model.ParametersDefinitionProperty",
            "parameterDefinitions": [
              {
                "_class": "jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition",
                "defaultParameterValue": {
                  "_class": "hudson.model.StringParameterValue",
                  "name": "extchoice1",
                  "value": "value1"
                },
                "description": "",
                "name": "extchoice1",
                "type": "ExtensibleChoiceParameterDefinition",
                "choiceList": [
                  "value1",
                  "value2",
                  "value3"
                ]
              }
            ]
          }
        ],
        ...
      }
      

      Built-in choice parameter also exposed its choice in JENKINS-3703 to allow Eclipse retrieve choices to trigger builds. Built-in choice returns choices in REST api in this way:

              {
                "_class": "hudson.model.ChoiceParameterDefinition",
                "defaultParameterValue": {
                  "_class": "hudson.model.StringParameterValue",
                  "name": "choice1",
                  "value": "value1"
                },
                "description": "",
                "name": "choice1",
                "type": "ChoiceParameterDefinition",
                "choices": [
                  "value1",
                  "value2",
                  "value3"
                ]
              }
      

      See https://github.com/jenkinsci/extensible-choice-parameter-plugin/pull/43

        Attachments

          Issue Links

            Activity

            Hide
            ikedam ikedam added a comment -

            Thanks a lot for your contribution.

            extensible-choice-parameter-1.7.0 is released.
            It will be available in the update center in a day.
            Please try that.

            Show
            ikedam ikedam added a comment - Thanks a lot for your contribution. extensible-choice-parameter-1.7.0 is released. It will be available in the update center in a day. Please try that.

              People

              Assignee:
              dtrunk90 Danny Trunk
              Reporter:
              dtrunk90 Danny Trunk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: