jenkinsci / pipeline-github-plugin

Pipeline: GitHub
https://plugins.jenkins.io/pipeline-github/
MIT License
159 stars 73 forks source link

Job Parameters are overwritten #120

Open pamelasarkisyan opened 1 year ago

pamelasarkisyan commented 1 year ago

Jenkins and plugins versions report

When triggering the job using issueCommentTrigger all existing parameters are getting removed and only the new ones are visible.

Lines that are probably introducing this behaviour are:

https://github.com/jenkinsci/pipeline-github-plugin/blob/2.8-141.7e985db66f30/src/main/java/org/jenkinsci/plugins/pipeline/github/trigger/GitHubEventSubscriber.java#L132-L134

Environment: Jenkins 2.361.3 Pipeline: GitHub -> Version2.8-141.7e985db66f30

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

N/A

Reproduction steps

Create a job with any parameters. Trigger the job via a comment. Navigate to Parameters for the Job that started.

Expected Results

You should see the existing parameters of the Job with the default values as defined in the job. (In my case it is declarative job so those are defined in Jenkinsfile)

Actual Results

The only parameters that you will see are: GITHUB_COMMENT and GITHUB_COMMENT_AUTHOR Existing parameters have been removed.

Anything else?

https://github.com/jenkinsci/pipeline-github-plugin/commit/ebc7956cb980c7897c8e951fcde01cf4dd6a7731 This commit is aiming to add environment variables (commit name is: expose comments as env variables) but it instead add parameters.

aaronwalker commented 1 year ago

@pamelasarkisyan when you trigger the job via a comment your expectation is you'd have the default values for any custom parameters correct? Since there is no way to trigger the custom using a comment and also pass parameters to the job.

pamelasarkisyan commented 1 year ago

@aaronwalker Yes exactly I want to start the job via comment and keep the custom parameters with their default values.

Can GITHUB_COMMENT and GITHUB_COMMENT_AUTHOR be added as environment variables instead of parameters?

aaronwalker commented 1 year ago

@pamelasarkisyan ok let me take a look