{"action":"created","issue":{"url":"https://api.github.com/repos/gocd/gocd/issues/1825","repository_url":"https://api.github.com/repos/gocd/gocd","labels_url":"https://api.github.com/repos/gocd/gocd/issues/1825/labels{/name}","comments_url":"https://api.github.com/repos/gocd/gocd/issues/1825/comments","events_url":"https://api.github.com/repos/gocd/gocd/issues/1825/events","html_url":"https://github.com/gocd/gocd/pull/1825","id":128151781,"number":1825,"title":"1133 configrepo extension","user":{"login":"tomzo","id":5710970,"avatar_url":"https://avatars.githubusercontent.com/u/5710970?v=3","gravatar_id":"","url":"https://api.github.com/users/tomzo","html_url":"https://github.com/tomzo","followers_url":"https://api.github.com/users/tomzo/followers","following_url":"https://api.github.com/users/tomzo/following{/other_user}","gists_url":"https://api.github.com/users/tomzo/gists{/gist_id}","starred_url":"https://api.github.com/users/tomzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomzo/subscriptions","organizations_url":"https://api.github.com/users/tomzo/orgs","repos_url":"https://api.github.com/users/tomzo/repos","events_url":"https://api.github.com/users/tomzo/events{/privacy}","received_events_url":"https://api.github.com/users/tomzo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-22T12:58:14Z","updated_at":"2016-06-02T11:52:14Z","closed_at":"2016-06-01T23:23:54Z","pull_request":{"url":"https://api.github.com/repos/gocd/gocd/pulls/1825","html_url":"https://github.com/gocd/gocd/pull/1825","diff_url":"https://github.com/gocd/gocd/pull/1825.diff","patch_url":"https://github.com/gocd/gocd/pull/1825.patch"},"body":"@arvindsv we've been discissing this so many times that I will just summarize what I think is most important to review.\r\n\r\nDocumentation WIP is [here](https://github.com/tomzo/documentation/tree/1133-configrepo-extension/developer/writing_go_plugins/configrepo)\r\n\r\nSome notes:\r\n * field names in contract classes are used by gson to deduct proper json \"schema\". So once this is released we should not do renames without adding migration transform with jolt.\r\n * using gson has downside that it does not support \"strict\" mode. So when plugin reponse has unknown fields then these are ignored silently. Which is bad in terms of user errors e.g. when response has `\"nme : \"bla\"` instead of `\"name\" : \"bla\"`, but it is good when user wants to start migration of configuration repositories before upgrading server. E.g. user can add fields which will be supported by next Go version and current server will not complain.\r\n * equality and constructors in contract classes are just for tests\r\n * [working example of configuration repository in json](https://github.com/tomzo/gocd-json-config-example) - I use it to validate end-user functionality. I plan to add more pipelines and environments to cover all objects. \r\n\r\nCode that requires looking at:\r\n * [Handling response from plugin](https://github.com/gocd/gocd/compare/master...tomzo:1133-configrepo-extension-pr?expand=1#diff-8300e2ccc8a80eafcc4964b68e138d15R46)\r\n * I developed [base test class](https://github.com/gocd/gocd/compare/master...tomzo:1133-configrepo-extension-pr?expand=1#diff-8e4f9225fad62e452d9e40a80a75f203R22) to help me manage the amount of contract classes to test. It uses *bad* and *good* examples to test common expectations about serialization and validation. There are also a few extra test cases on specific types when I felt it is necessary to test more details.\r\n\r\n### New health scope\r\n\r\nI wanted to make it a separate PR but it was hard to cherry-pick. So please have a look at just [this one commit](https://github.com/gocd/gocd/commit/5ed9ee9d01f18321f29ab0fd5cb74e04755cfb92) which adds new health scope and error messages per configuration repository. \r\n\r\n### Jolt and migration\r\n\r\nI added jolt 0.0.20 as dependency in `plugin-access` module.\r\nNow there is no need to migrate anything, but I wanted to prototype how it could look like with jolts help. So there is a [\"test\"](https://github.com/gocd/gocd/compare/master...tomzo:1133-configrepo-extension-pr?expand=1#diff-1f44ce40dfc08bf1d327e1e7ba7f6fffR23) which declares some hypothetic \"V2\" contract classes. Then I used jolt to move some json objects to another field and also I also used it to add some default values.\r\n\r\n### Commit history\r\n\r\nUnfortunatelly, there is a mess in few moments and I would not recommend reviewing this PR commit-by-commit. Mostly because initially I implemented this with `go-plugin-config-repo` module and then removed it as you know already. So the end result is quite far from what original intent was."},"comment":{"url":"https://api.github.com/repos/gocd/gocd/issues/comments/223269352","html_url":"https://github.com/gocd/gocd/pull/1825#issuecomment-223269352","issue_url":"https://api.github.com/repos/gocd/gocd/issues/1825","id":223269352,"user":{"login":"arvindsv","id":172235,"avatar_url":"https://avatars.githubusercontent.com/u/172235?v=3","gravatar_id":"","url":"https://api.github.com/users/arvindsv","html_url":"https://github.com/arvindsv","followers_url":"https://api.github.com/users/arvindsv/followers","following_url":"https://api.github.com/users/arvindsv/following{/other_user}","gists_url":"https://api.github.com/users/arvindsv/gists{/gist_id}","starred_url":"https://api.github.com/users/arvindsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arvindsv/subscriptions","organizations_url":"https://api.github.com/users/arvindsv/orgs","repos_url":"https://api.github.com/users/arvindsv/repos","events_url":"https://api.github.com/users/arvindsv/events{/privacy}","received_events_url":"https://api.github.com/users/arvindsv/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T11:52:14Z","updated_at":"2016-06-02T11:52:14Z","body":"Ah, cool."}}
{"actor":{"display_login":"arvindsv"}}