{"action":"created","issue":{"url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/573","repository_url":"https://api.github.com/repos/jenkinsci/blueocean-plugin","labels_url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/573/labels{/name}","comments_url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/573/comments","events_url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/573/events","html_url":"https://github.com/jenkinsci/blueocean-plugin/pull/573","id":185550641,"number":573,"title":"JENKINS-38847# API to create multi-branch pipeline for given SCM","user":{"login":"vivek","id":38139,"avatar_url":"https://avatars.githubusercontent.com/u/38139?v=3","gravatar_id":"","url":"https://api.github.com/users/vivek","html_url":"https://github.com/vivek","followers_url":"https://api.github.com/users/vivek/followers","following_url":"https://api.github.com/users/vivek/following{/other_user}","gists_url":"https://api.github.com/users/vivek/gists{/gist_id}","starred_url":"https://api.github.com/users/vivek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vivek/subscriptions","organizations_url":"https://api.github.com/users/vivek/orgs","repos_url":"https://api.github.com/users/vivek/repos","events_url":"https://api.github.com/users/vivek/events{/privacy}","received_events_url":"https://api.github.com/users/vivek/received_events","type":"User","site_admin":false},"labels":[{"id":334266887,"url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/labels/needs-review","name":"needs-review","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":54,"created_at":"2016-10-27T01:19:13Z","updated_at":"2016-12-21T03:40:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/pulls/573","html_url":"https://github.com/jenkinsci/blueocean-plugin/pull/573","diff_url":"https://github.com/jenkinsci/blueocean-plugin/pull/573.diff","patch_url":"https://github.com/jenkinsci/blueocean-plugin/pull/573.patch"},"body":"# Description\r\n\r\nSee [JENKINS-38847](https://issues.jenkins-ci.org/browse/JENKINS-38847).\r\n\r\nWork in progress. Following tasks to be completed before review:\r\n[x] Basic implementation of API to create multi-branch pipeline for given GitHub org\r\n\r\nBasic implementation is in place. If you make this POST request on this PR branch, you will have an organization folder with name cloudbeers created with only one branch PR-demo.\r\n\r\nReason I do not have it marked completed is to probably be able to change request/response format.\r\n\r\n## Create Git SCM pipeline\r\n```\r\ncurl -v -u admin:admin -H 'Content-Type: application/json' http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/  -d \r\n'{\r\n  \"name\" : \"cloudbeers\",\r\n  \"$class\" : \"io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineCreateRequest\",\r\n  \"scmConfig\" : {\r\n    \"uri\": \"/Users/vivek/dev/hellokyoto\"\r\n  }\r\n}'\r\n```\r\n\r\n\r\n## Create GitHub organization pipeline\r\n```\r\ncurl -v -u admin:admin -H 'Content-Type: application/json' http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/  -d \r\n'{\r\n  \"name\" : \"cloudbeers\", \r\n  \"$class\" : \"io.jenkins.blueocean.blueocean_github_pipeline.GithubPipelineCreateRequest\",\r\n  \"scmConfig\" : {\r\n    \"uri\":\"https://api.github.com\", // optional for github, required for enterprise where it should be http://ghe.acme.com/api/v3\r\n    \"credentialId\": \"083f40b0-fe08-464a-95d9-21953804c6e9\", //optional\r\n    \"config\":{\r\n        \"orgName\": \"cloudbeers\", //optional, if absent name element is used as orgName\r\n        \"repos\" : [ \"PR-demo\" ] //optional, if not provided all repos in this org are tried\r\n    }\r\n  }\r\n}'\r\n```\r\n- Only **name** and **creatorId** are required element\r\n- For any SCM type or for any specific job type can be created by implementing BluePipelineCreator extension point. See: [GithubPipelineCreatorImpl.java](https://github.com/jenkinsci/blueocean-plugin/blob/story/JENKINS-38847/blueocean-github-pipeline/src/main/java/io/jenkins/blueocean/blueocean_github_pipeline/GithubPipelineCreatorImpl.java) and [BluePipelineCreator.java](https://github.com/jenkinsci/blueocean-plugin/blob/story/JENKINS-38847/blueocean-rest/src/main/java/io/jenkins/blueocean/rest/model/BluePipelineCreator.java).\r\n\r\n- [x] API to re-run organization folder, also returns run details and log of previous organization folder run.\r\n- [x] Implement git pipeline creation\r\n- [x] Show in progress pipeline status \r\n- Return in progress pipelines with status in the response of /pipelines/:orgName/pipelines\r\n- [x] Create API should throw 400 error on duplicate 'name' - that is org folder name and also for invalid credentialId.\r\n- [x] Implement PUT in the implementation for /pipelines/:orgName/ to update its setting - e.g. to update repos to be scanned\r\n\r\nUpdate API for GitHub and Git implemented.\r\n\r\n## Update GitHub org folder\r\n\r\n```\r\ncurl -v -u admin:admin -H 'Content-Type: application/json' -X PUT http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/cloudbeers1/  -d '{\r\n  \"$class\" : \"io.jenkins.blueocean.blueocean_github_pipeline.GithubPipelineUpdateRequest\",\r\n  \"scmConfig\" : {\"credentialId\": \"vivek-github\",\r\n  \"config\":{\"repos\" : [ \"PR-demo\",\"advanced\" ], \"orgName\":\"cloudbeers\"}}\r\n}'\r\n```\r\n> Note that, if **repos** is not empty then only the given repos will be used to create pipelines. If **repos** is empty then it means auto-scan, that is all repos will be fetched and pipeline jobs will be created for those with Jenkinsfile.\r\n\r\n## Update Git multi-branch project\r\n\r\nThis is basically to trigger re-indexing\r\n\r\n```\r\ncurl -v -u admin:admin -H 'Content-Type: application/json' -X PUT http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/hk1/  -d '{\r\n  \"$class\" : \"io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineUpdateRequest\",\r\n  \"scmConfig\" : {\"uri\":\"/Users/vivek/dev/hellokyoto\"}\r\n}'\r\n```\r\n\r\n- [ ] Testing and test cases\r\n\r\n# Submitter checklist\r\n- [x] Link to JIRA ticket in description, if appropriate.\r\n- [ ] Change is code complete and matches issue description\r\n- [ ] Appropriate unit or acceptance tests or explanation to why this change has no tests\r\n- [ ] Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.\r\n- [ ] Ran Acceptance Test Harness against PR changes.\r\n# Reviewer checklist\r\n- [ ] Run the changes and verified the change matches the issue description\r\n- [ ] Reviewed the code\r\n- [ ] Verified that the appropriate tests have been written or valid explanation given"},"comment":{"url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/comments/268427589","html_url":"https://github.com/jenkinsci/blueocean-plugin/pull/573#issuecomment-268427589","issue_url":"https://api.github.com/repos/jenkinsci/blueocean-plugin/issues/573","id":268427589,"user":{"login":"vivek","id":38139,"avatar_url":"https://avatars.githubusercontent.com/u/38139?v=3","gravatar_id":"","url":"https://api.github.com/users/vivek","html_url":"https://github.com/vivek","followers_url":"https://api.github.com/users/vivek/followers","following_url":"https://api.github.com/users/vivek/following{/other_user}","gists_url":"https://api.github.com/users/vivek/gists{/gist_id}","starred_url":"https://api.github.com/users/vivek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vivek/subscriptions","organizations_url":"https://api.github.com/users/vivek/orgs","repos_url":"https://api.github.com/users/vivek/repos","events_url":"https://api.github.com/users/vivek/events{/privacy}","received_events_url":"https://api.github.com/users/vivek/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T03:40:33Z","updated_at":"2016-12-21T03:40:33Z","body":"@michaelneale ah, right. I will add these plugins so that they have deploy permission."}}
{"actor":{"display_login":"vivek"}}