{"action":"created","comment":{"url":"https://api.github.com/repos/spinnaker/orca/pulls/comments/139846023","pull_request_review_id":63833304,"id":139846023,"diff_hunk":"@@ -59,6 +60,36 @@ public void visitPipelineTemplate(PipelineTemplate pipelineTemplate) {\n       throw new IllegalTemplateConfigurationException(\"Missing variable values for: \" + StringUtils.join(missingVariables, \", \"));\n     }\n \n-    // TODO rz - validate variable values match the defined variable type\n+    // collect variables where value type doesn't match the required type\n+    List<String> wrongTypeErrorMessages = pipelineTemplateVariables.stream()\n+      .filter(templateVar -> {\n+        if (missingVariables.contains(templateVar.getName())) {\n+          return false; // filter missing values from this list\n+        }\n+\n+        String expectedType = templateVar.getType();\n+        if (expectedType.equals(\"object\")) {\n+          return false; // not invalid, all classes are objects\n+        }\n+\n+        String actualType = configVars.get(templateVar.getName()).getClass().getSimpleName();\n+\n+        if (expectedType.equals(\"int\") && actualType.equals(\"Integer\")){\n+          return false;\n+        } else if (expectedType.equals(\"list\") && actualType.equals(\"ArrayList\")) {\n+          return false;\n+        } else if (expectedType.equals(actualType.toLowerCase())) {\n+          return false;\n+        } else if (expectedType.equals(actualType)){\n+          return false; // types match\n+        }\n+        return true; //types don't match, add to list\n+      })\n+       .map(var -> var.getName() + \" (expected type '\" + var.getType() + \"' found type '\" + configVars.get(var.getName()).getClass().getSimpleName() + \"')\")","path":"orca-pipelinetemplate/src/main/java/com/netflix/spinnaker/orca/pipelinetemplate/v1schema/graph/transform/DefaultVariableAssignmentTransform.java","position":54,"original_position":54,"commit_id":"1c38a3c4ad9ca59edf548f70a35d39b64eee77ca","original_commit_id":"1c38a3c4ad9ca59edf548f70a35d39b64eee77ca","user":{"login":"robzienert","id":108741,"avatar_url":"https://avatars0.githubusercontent.com/u/108741?v=4","gravatar_id":"","url":"https://api.github.com/users/robzienert","html_url":"https://github.com/robzienert","followers_url":"https://api.github.com/users/robzienert/followers","following_url":"https://api.github.com/users/robzienert/following{/other_user}","gists_url":"https://api.github.com/users/robzienert/gists{/gist_id}","starred_url":"https://api.github.com/users/robzienert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robzienert/subscriptions","organizations_url":"https://api.github.com/users/robzienert/orgs","repos_url":"https://api.github.com/users/robzienert/repos","events_url":"https://api.github.com/users/robzienert/events{/privacy}","received_events_url":"https://api.github.com/users/robzienert/received_events","type":"User","site_admin":false},"body":"We've already got the actualType, we can use that here rather than getting again.","created_at":"2017-09-19T23:50:50Z","updated_at":"2017-09-19T23:52:04Z","html_url":"https://github.com/spinnaker/orca/pull/1629#discussion_r139846023","pull_request_url":"https://api.github.com/repos/spinnaker/orca/pulls/1629","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/comments/139846023"},"html":{"href":"https://github.com/spinnaker/orca/pull/1629#discussion_r139846023"},"pull_request":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/1629"}}},"pull_request":{"url":"https://api.github.com/repos/spinnaker/orca/pulls/1629","id":141979879,"html_url":"https://github.com/spinnaker/orca/pull/1629","diff_url":"https://github.com/spinnaker/orca/pull/1629.diff","patch_url":"https://github.com/spinnaker/orca/pull/1629.patch","issue_url":"https://api.github.com/repos/spinnaker/orca/issues/1629","number":1629,"state":"open","locked":false,"title":"fix(managed_pipeline): validation of variable types, integration test…","user":{"login":"emjburns","id":8454927,"avatar_url":"https://avatars1.githubusercontent.com/u/8454927?v=4","gravatar_id":"","url":"https://api.github.com/users/emjburns","html_url":"https://github.com/emjburns","followers_url":"https://api.github.com/users/emjburns/followers","following_url":"https://api.github.com/users/emjburns/following{/other_user}","gists_url":"https://api.github.com/users/emjburns/gists{/gist_id}","starred_url":"https://api.github.com/users/emjburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emjburns/subscriptions","organizations_url":"https://api.github.com/users/emjburns/orgs","repos_url":"https://api.github.com/users/emjburns/repos","events_url":"https://api.github.com/users/emjburns/events{/privacy}","received_events_url":"https://api.github.com/users/emjburns/received_events","type":"User","site_admin":false},"body":"…s for invalid pipelines\r\nValidation of variable types, and integration tests around this.\r\nAlso adding integration tests for invalid stage formats, bad versions.\r\n\r\n@robzienert PTAL","created_at":"2017-09-19T23:30:30Z","updated_at":"2017-09-19T23:52:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f670b821019fd72a6238eccbadcb525378b1c3e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/spinnaker/orca/pulls/1629/commits","review_comments_url":"https://api.github.com/repos/spinnaker/orca/pulls/1629/comments","review_comment_url":"https://api.github.com/repos/spinnaker/orca/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spinnaker/orca/issues/1629/comments","statuses_url":"https://api.github.com/repos/spinnaker/orca/statuses/1c38a3c4ad9ca59edf548f70a35d39b64eee77ca","head":{"label":"emjburns:mpt","ref":"mpt","sha":"1c38a3c4ad9ca59edf548f70a35d39b64eee77ca","user":{"login":"emjburns","id":8454927,"avatar_url":"https://avatars1.githubusercontent.com/u/8454927?v=4","gravatar_id":"","url":"https://api.github.com/users/emjburns","html_url":"https://github.com/emjburns","followers_url":"https://api.github.com/users/emjburns/followers","following_url":"https://api.github.com/users/emjburns/following{/other_user}","gists_url":"https://api.github.com/users/emjburns/gists{/gist_id}","starred_url":"https://api.github.com/users/emjburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emjburns/subscriptions","organizations_url":"https://api.github.com/users/emjburns/orgs","repos_url":"https://api.github.com/users/emjburns/repos","events_url":"https://api.github.com/users/emjburns/events{/privacy}","received_events_url":"https://api.github.com/users/emjburns/received_events","type":"User","site_admin":false},"repo":{"id":102022240,"name":"orca","full_name":"emjburns/orca","owner":{"login":"emjburns","id":8454927,"avatar_url":"https://avatars1.githubusercontent.com/u/8454927?v=4","gravatar_id":"","url":"https://api.github.com/users/emjburns","html_url":"https://github.com/emjburns","followers_url":"https://api.github.com/users/emjburns/followers","following_url":"https://api.github.com/users/emjburns/following{/other_user}","gists_url":"https://api.github.com/users/emjburns/gists{/gist_id}","starred_url":"https://api.github.com/users/emjburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emjburns/subscriptions","organizations_url":"https://api.github.com/users/emjburns/orgs","repos_url":"https://api.github.com/users/emjburns/repos","events_url":"https://api.github.com/users/emjburns/events{/privacy}","received_events_url":"https://api.github.com/users/emjburns/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emjburns/orca","description":"orchestration engine","fork":true,"url":"https://api.github.com/repos/emjburns/orca","forks_url":"https://api.github.com/repos/emjburns/orca/forks","keys_url":"https://api.github.com/repos/emjburns/orca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emjburns/orca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emjburns/orca/teams","hooks_url":"https://api.github.com/repos/emjburns/orca/hooks","issue_events_url":"https://api.github.com/repos/emjburns/orca/issues/events{/number}","events_url":"https://api.github.com/repos/emjburns/orca/events","assignees_url":"https://api.github.com/repos/emjburns/orca/assignees{/user}","branches_url":"https://api.github.com/repos/emjburns/orca/branches{/branch}","tags_url":"https://api.github.com/repos/emjburns/orca/tags","blobs_url":"https://api.github.com/repos/emjburns/orca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emjburns/orca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emjburns/orca/git/refs{/sha}","trees_url":"https://api.github.com/repos/emjburns/orca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emjburns/orca/statuses/{sha}","languages_url":"https://api.github.com/repos/emjburns/orca/languages","stargazers_url":"https://api.github.com/repos/emjburns/orca/stargazers","contributors_url":"https://api.github.com/repos/emjburns/orca/contributors","subscribers_url":"https://api.github.com/repos/emjburns/orca/subscribers","subscription_url":"https://api.github.com/repos/emjburns/orca/subscription","commits_url":"https://api.github.com/repos/emjburns/orca/commits{/sha}","git_commits_url":"https://api.github.com/repos/emjburns/orca/git/commits{/sha}","comments_url":"https://api.github.com/repos/emjburns/orca/comments{/number}","issue_comment_url":"https://api.github.com/repos/emjburns/orca/issues/comments{/number}","contents_url":"https://api.github.com/repos/emjburns/orca/contents/{+path}","compare_url":"https://api.github.com/repos/emjburns/orca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emjburns/orca/merges","archive_url":"https://api.github.com/repos/emjburns/orca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emjburns/orca/downloads","issues_url":"https://api.github.com/repos/emjburns/orca/issues{/number}","pulls_url":"https://api.github.com/repos/emjburns/orca/pulls{/number}","milestones_url":"https://api.github.com/repos/emjburns/orca/milestones{/number}","notifications_url":"https://api.github.com/repos/emjburns/orca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emjburns/orca/labels{/name}","releases_url":"https://api.github.com/repos/emjburns/orca/releases{/id}","deployments_url":"https://api.github.com/repos/emjburns/orca/deployments","created_at":"2017-08-31T16:36:53Z","updated_at":"2017-08-31T16:36:59Z","pushed_at":"2017-09-19T23:20:50Z","git_url":"git://github.com/emjburns/orca.git","ssh_url":"git@github.com:emjburns/orca.git","clone_url":"https://github.com/emjburns/orca.git","svn_url":"https://github.com/emjburns/orca","homepage":"","size":9441,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spinnaker:master","ref":"master","sha":"77ff216786e0507f09169f9cd349c557657dd5cf","user":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars1.githubusercontent.com/u/7634182?v=4","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"repo":{"id":19834314,"name":"orca","full_name":"spinnaker/orca","owner":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars1.githubusercontent.com/u/7634182?v=4","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spinnaker/orca","description":"orchestration engine","fork":false,"url":"https://api.github.com/repos/spinnaker/orca","forks_url":"https://api.github.com/repos/spinnaker/orca/forks","keys_url":"https://api.github.com/repos/spinnaker/orca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinnaker/orca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinnaker/orca/teams","hooks_url":"https://api.github.com/repos/spinnaker/orca/hooks","issue_events_url":"https://api.github.com/repos/spinnaker/orca/issues/events{/number}","events_url":"https://api.github.com/repos/spinnaker/orca/events","assignees_url":"https://api.github.com/repos/spinnaker/orca/assignees{/user}","branches_url":"https://api.github.com/repos/spinnaker/orca/branches{/branch}","tags_url":"https://api.github.com/repos/spinnaker/orca/tags","blobs_url":"https://api.github.com/repos/spinnaker/orca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinnaker/orca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinnaker/orca/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinnaker/orca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinnaker/orca/statuses/{sha}","languages_url":"https://api.github.com/repos/spinnaker/orca/languages","stargazers_url":"https://api.github.com/repos/spinnaker/orca/stargazers","contributors_url":"https://api.github.com/repos/spinnaker/orca/contributors","subscribers_url":"https://api.github.com/repos/spinnaker/orca/subscribers","subscription_url":"https://api.github.com/repos/spinnaker/orca/subscription","commits_url":"https://api.github.com/repos/spinnaker/orca/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinnaker/orca/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinnaker/orca/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinnaker/orca/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinnaker/orca/contents/{+path}","compare_url":"https://api.github.com/repos/spinnaker/orca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinnaker/orca/merges","archive_url":"https://api.github.com/repos/spinnaker/orca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinnaker/orca/downloads","issues_url":"https://api.github.com/repos/spinnaker/orca/issues{/number}","pulls_url":"https://api.github.com/repos/spinnaker/orca/pulls{/number}","milestones_url":"https://api.github.com/repos/spinnaker/orca/milestones{/number}","notifications_url":"https://api.github.com/repos/spinnaker/orca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinnaker/orca/labels{/name}","releases_url":"https://api.github.com/repos/spinnaker/orca/releases{/id}","deployments_url":"https://api.github.com/repos/spinnaker/orca/deployments","created_at":"2014-05-15T20:33:00Z","updated_at":"2017-09-06T22:07:19Z","pushed_at":"2017-09-19T23:30:31Z","git_url":"git://github.com/spinnaker/orca.git","ssh_url":"git@github.com:spinnaker/orca.git","clone_url":"https://github.com/spinnaker/orca.git","svn_url":"https://github.com/spinnaker/orca","homepage":"","size":9453,"stargazers_count":62,"watchers_count":62,"language":"Groovy","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":54,"forks":118,"open_issues":54,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/1629"},"html":{"href":"https://github.com/spinnaker/orca/pull/1629"},"issue":{"href":"https://api.github.com/repos/spinnaker/orca/issues/1629"},"comments":{"href":"https://api.github.com/repos/spinnaker/orca/issues/1629/comments"},"review_comments":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/1629/comments"},"review_comment":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spinnaker/orca/pulls/1629/commits"},"statuses":{"href":"https://api.github.com/repos/spinnaker/orca/statuses/1c38a3c4ad9ca59edf548f70a35d39b64eee77ca"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"robzienert"}}