{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/254","repository_url":"https://api.github.com/repos/openshift/jenkins-sync-plugin","labels_url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/254/labels{/name}","comments_url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/254/comments","events_url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/254/events","html_url":"https://github.com/openshift/jenkins-sync-plugin/pull/254","id":353672738,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNjU5MTcz","number":254,"title":"Fix duplicate job run parameters","user":{"login":"vfreex","id":9941773,"node_id":"MDQ6VXNlcjk5NDE3NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/9941773?v=4","gravatar_id":"","url":"https://api.github.com/users/vfreex","html_url":"https://github.com/vfreex","followers_url":"https://api.github.com/users/vfreex/followers","following_url":"https://api.github.com/users/vfreex/following{/other_user}","gists_url":"https://api.github.com/users/vfreex/gists{/gist_id}","starred_url":"https://api.github.com/users/vfreex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vfreex/subscriptions","organizations_url":"https://api.github.com/users/vfreex/orgs","repos_url":"https://api.github.com/users/vfreex/repos","events_url":"https://api.github.com/users/vfreex/events{/privacy}","received_events_url":"https://api.github.com/users/vfreex/received_events","type":"User","site_admin":false},"labels":[{"id":770419159,"node_id":"MDU6TGFiZWw3NzA0MTkxNTk=","url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":770419125,"node_id":"MDU6TGFiZWw3NzA0MTkxMjU=","url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/labels/lgtm","name":"lgtm","color":"15dd18","default":false},{"id":770419006,"node_id":"MDU6TGFiZWw3NzA0MTkwMDY=","url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/labels/size/S","name":"size/S","color":"77bb00","default":false}],"state":"open","locked":false,"assignee":{"login":"gabemontero","id":3594868,"node_id":"MDQ6VXNlcjM1OTQ4Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/3594868?v=4","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"assignees":[{"login":"gabemontero","id":3594868,"node_id":"MDQ6VXNlcjM1OTQ4Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/3594868?v=4","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-08-24T07:21:25Z","updated_at":"2018-08-27T02:32:11Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/pulls/254","html_url":"https://github.com/openshift/jenkins-sync-plugin/pull/254","diff_url":"https://github.com/openshift/jenkins-sync-plugin/pull/254.diff","patch_url":"https://github.com/openshift/jenkins-sync-plugin/pull/254.patch"},"body":"Triggering a job run from Jenkins UI or triggers defined in the job\r\ncould cause duplicate parameters. This is caused by missing checks\r\nbetween the build strategy parameters and user specified parameters.\r\n\r\nUsing LinkedHashMap instread of ArrayList for parameters can\r\nsolve this issue, where the user specified parameters are able to overrides those defined in the build strategy silently.\r\n\r\nReproduction:\r\nCreate a BuildConfig on OpenShift with JenkinsPipelineBuildStrategy, define an environment variable `NAME`. Note there is a cron trigger that triggers this job every 3 minutes.\r\n\r\n```yaml\r\nkind: \"BuildConfig\"\r\napiVersion: \"v1\"\r\nmetadata:\r\n  name: \"demo-pipeline\"\r\nspec:\r\n  strategy:\r\n    jenkinsPipelineStrategy:\r\n      env:\r\n      - name: \"NAME\"\r\n        value: \"openshift\"\r\n      jenkinsfile: |-\r\n        pipeline {\r\n          agent {\r\n            kubernetes {\r\n              cloud 'openshift'\r\n              label \"jenkins-slave-${UUID.randomUUID().toString()}\"\r\n              yaml \"\"\"\r\n              apiVersion: v1\r\n              kind: Pod\r\n              metadata:\r\n                labels:\r\n                  app: \"my-jenkins-slave\"\r\n              spec:\r\n                containers:\r\n                - name: jnlp\r\n                  image: docker.io/openshift/jenkins-slave-base-centos7:latest\r\n                  tty: true\r\n                  resources:\r\n                    requests:\r\n                      memory: 512Mi\r\n                      cpu: 200m\r\n              \"\"\"\r\n            }\r\n          }\r\n          triggers { cron('*/3 * * * *') }\r\n          stages {\r\n            stage('foo') {\r\n              steps {\r\n                echo \"Hello, ${params.NAME}\"\r\n              }\r\n            }\r\n          }\r\n        }\r\n```\r\nThen start a job run with `oc start-build demo-pipeline` to let Jenkins Sync plugin create a Jenkins job.\r\nNext, start a job run from Jenkins UI, or wait for a new job run started by the cron trigger. You should see there are 2 duplicate parameters with the same name."},"comment":{"url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/comments/416097518","html_url":"https://github.com/openshift/jenkins-sync-plugin/pull/254#issuecomment-416097518","issue_url":"https://api.github.com/repos/openshift/jenkins-sync-plugin/issues/254","id":416097518,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjA5NzUxOA==","user":{"login":"gabemontero","id":3594868,"node_id":"MDQ6VXNlcjM1OTQ4Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/3594868?v=4","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T02:32:11Z","updated_at":"2018-08-27T02:32:11Z","author_association":"NONE","body":"thanks @vfreex !"}}
{"actor":{"display_login":"gabemontero"}}