{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/comments/151533179","pull_request_review_id":77258037,"id":151533179,"diff_hunk":"@@ -0,0 +1,172 @@\n+package jenkins.automation.utils\n+\n+\n+import java.util.Map\n+\n+\n+class CheckmarxUtils {\n+\n+/**\n+ * Reusable block to add Checkmarx scanning to a project\n+ *\n+ * @param context A reference to the job object being modified\n+ *                (typically via <code>delegate</code>)\n+ * @param cxConfig A <code>Map</code> used to configure the Checkmarx project.\n+ *                 Valid keys:\n+ * <br/>&#x2014; <code>projectName</code>: required, specifies the name of the\n+ *               Checkmarx project\n+ * <br/>&#x2014; <code>groupId</code>: required, specifies group ID, which is\n+ *               actually the team ID, and which can be gotten by\n+ *               browser-inspecting the 'Team' select box for an existing\n+ *               Checkmarx job in the Jenkins UI\n+ * <br/>&#x2014; <code>preset</code>: optional, defaults to \"Default 2014\" preset,\n+ *               the ID of the Checkmarx preset configuration to use; this can be\n+ *               gotten by browser-inspecting the 'Preset' select box for an existing\n+ *               Checkmarx job in the Jenkins UI\n+ * <br/>&#x2014; <code>useOwnServerCredentials</code>: optional, defaults to\n+ *               <code>false</code>, specifies whether to use the global or per-job\n+ *               Checkmarx server URL/credentials\n+ * <br/>&#x2014; <code>serverUrl</code>: optional, specifies the Checkmarx server\n+ *               URL to be used\n+ * <br/>&#x2014; <code>username</code>: optional, specifies the Checkmarx username\n+ * <br/>&#x2014; <code>password</code>: optional, specifies the Checkmarx password\n+ * <br/>&#x2014; <code>excludeFolders</code>: optional, see code for the default,\n+ *               specifies the directories to exclude from scanning\n+ * <br/>&#x2014; <code>filterPattern</code>: optional, see code for the default,\n+ *               specifies globs to filter out\n+ * <br/>&#x2014; <code>incremental</code>: optional, defaults to <code>true</code>,\n+ *               specifies whether scan should be incremental\n+ * <br/>&#x2014; <code>fullScanCycle</code>: optional, defaults to <code>10</code>,\n+ *               specifies how frequently to run a full scan when normally doing\n+ *               incremental scans\n+ * <br/>&#x2014; <code>comment</code>: optional, additional comments to be adding\n+ *               to the scan results\n+ * <br/>&#x2014; <code>vulnerabilityThreshold</code>: optional, defaults to\n+ *               <code>true</code>, fail the build if the number of vulnerabilities\n+ *               exceeds the thresholds set\n+ * <br/>&#x2014; <code>highThresholdDefault</code>: optional, defaults to\n+ *               <code>1</code>, sets the threshold for max number of 'high'\n+ *               vulnerabilities\n+ * <br/>&#x2014; <code>mediumThresholdDefault</code>: optional, defaults to\n+ *               <code>2</code>, sets the threshold for max number of 'medium'\n+ *               vulnerabilities\n+ * <br/>&#x2014; <code>lowThresholdDefault</code>: optional, defaults to\n+ *               <code>3</code>, set the threshold for max number of 'low'\n+ *               vulnerabilities\n+ * @see <a href=\"https://github.com/cfpb/jenkins-automation/blob/gh-pages/docs/examples.md#checkmarx-security-job-builder\" target=\"_blank\">Checkmarx job Example</a>\n+ *\n+ */\n+\n+    static void checkmarxScan(context, Map cxConfig) {\n+        assert cxConfig.projectName != null\n+        assert cxConfig.groupId != null\n+\n+        def useOwnServerCredentialsDefault = false\n+        def presetDefault = \"17\" // \"Default 2014\"\n+        def excludeFoldersDefault = \"resources, .git\"\n+        def incrementalDefault = true\n+        def fullScanCycleDefault = \"10\"\n+        def commentDefault = \"\"\n+        def vulnerabilityThresholdDefault = true\n+        def highThresholdDefault = 1\n+        def mediumThresholdDefault = 2\n+        def lowThresholdDefault = 3\n+        def filterPatternDefault = \"\"\"\n+            !**/_cvs/**/*, !**/.svn/**/*,   !**/.hg/**/*,   !**/.git/**/*,  !**/.bzr/**/*, !**/bin/**/*,","path":"src/main/groovy/jenkins/automation/utils/CheckmarxUtils.groovy","position":75,"original_position":75,"commit_id":"f7bf25fef7827e1ec80a78345d3b5054629e3332","original_commit_id":"f7bf25fef7827e1ec80a78345d3b5054629e3332","user":{"login":"champain","id":6773712,"avatar_url":"https://avatars0.githubusercontent.com/u/6773712?v=4","gravatar_id":"","url":"https://api.github.com/users/champain","html_url":"https://github.com/champain","followers_url":"https://api.github.com/users/champain/followers","following_url":"https://api.github.com/users/champain/following{/other_user}","gists_url":"https://api.github.com/users/champain/gists{/gist_id}","starred_url":"https://api.github.com/users/champain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/champain/subscriptions","organizations_url":"https://api.github.com/users/champain/orgs","repos_url":"https://api.github.com/users/champain/repos","events_url":"https://api.github.com/users/champain/events{/privacy}","received_events_url":"https://api.github.com/users/champain/received_events","type":"User","site_admin":false},"body":"I experimented with a couple of different methods, and I settled on the one I'm seeing in JAC from HMDA and from Delivery that uses a groovy config file then ConfigSlurper to parse it.\r\n\r\nHMDA - https://github.cfpb.gov/HMDA-Operations/hmda-devops/blob/master/jenkins/apps/env.groovy\r\nDelivery uses a config file in `jenkins-automation-private`","created_at":"2017-11-16T20:50:09Z","updated_at":"2017-11-16T20:50:10Z","html_url":"https://github.com/cfpb/jenkins-automation/pull/119#discussion_r151533179","pull_request_url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/comments/151533179"},"html":{"href":"https://github.com/cfpb/jenkins-automation/pull/119#discussion_r151533179"},"pull_request":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119"}},"in_reply_to_id":151514068},"pull_request":{"url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119","id":152321294,"html_url":"https://github.com/cfpb/jenkins-automation/pull/119","diff_url":"https://github.com/cfpb/jenkins-automation/pull/119.diff","patch_url":"https://github.com/cfpb/jenkins-automation/pull/119.patch","issue_url":"https://api.github.com/repos/cfpb/jenkins-automation/issues/119","number":119,"state":"open","locked":false,"title":"Checkmarx builder clean-up and refactoring","user":{"login":"acrewdson","id":10353074,"avatar_url":"https://avatars0.githubusercontent.com/u/10353074?v=4","gravatar_id":"","url":"https://api.github.com/users/acrewdson","html_url":"https://github.com/acrewdson","followers_url":"https://api.github.com/users/acrewdson/followers","following_url":"https://api.github.com/users/acrewdson/following{/other_user}","gists_url":"https://api.github.com/users/acrewdson/gists{/gist_id}","starred_url":"https://api.github.com/users/acrewdson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acrewdson/subscriptions","organizations_url":"https://api.github.com/users/acrewdson/orgs","repos_url":"https://api.github.com/users/acrewdson/repos","events_url":"https://api.github.com/users/acrewdson/events{/privacy}","received_events_url":"https://api.github.com/users/acrewdson/received_events","type":"User","site_admin":false},"body":"This PR started as a few minor clean-up commits and ended with a larger refactoring commit that'll introduced breakages for existing Checkmarx JAC jobs.\r\n\r\nPlease step through the commits and review the diffs that way instead of reviewing the overall diff.","created_at":"2017-11-13T19:09:06Z","updated_at":"2017-11-16T20:50:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b25b03e3b435fba17b2b9d66669de9e71a95bab5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"marcesher","id":127017,"avatar_url":"https://avatars3.githubusercontent.com/u/127017?v=4","gravatar_id":"","url":"https://api.github.com/users/marcesher","html_url":"https://github.com/marcesher","followers_url":"https://api.github.com/users/marcesher/followers","following_url":"https://api.github.com/users/marcesher/following{/other_user}","gists_url":"https://api.github.com/users/marcesher/gists{/gist_id}","starred_url":"https://api.github.com/users/marcesher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcesher/subscriptions","organizations_url":"https://api.github.com/users/marcesher/orgs","repos_url":"https://api.github.com/users/marcesher/repos","events_url":"https://api.github.com/users/marcesher/events{/privacy}","received_events_url":"https://api.github.com/users/marcesher/received_events","type":"User","site_admin":false},{"login":"OrlandoSoto","id":7442823,"avatar_url":"https://avatars3.githubusercontent.com/u/7442823?v=4","gravatar_id":"","url":"https://api.github.com/users/OrlandoSoto","html_url":"https://github.com/OrlandoSoto","followers_url":"https://api.github.com/users/OrlandoSoto/followers","following_url":"https://api.github.com/users/OrlandoSoto/following{/other_user}","gists_url":"https://api.github.com/users/OrlandoSoto/gists{/gist_id}","starred_url":"https://api.github.com/users/OrlandoSoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrlandoSoto/subscriptions","organizations_url":"https://api.github.com/users/OrlandoSoto/orgs","repos_url":"https://api.github.com/users/OrlandoSoto/repos","events_url":"https://api.github.com/users/OrlandoSoto/events{/privacy}","received_events_url":"https://api.github.com/users/OrlandoSoto/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119/commits","review_comments_url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119/comments","review_comment_url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/jenkins-automation/issues/119/comments","statuses_url":"https://api.github.com/repos/cfpb/jenkins-automation/statuses/f7bf25fef7827e1ec80a78345d3b5054629e3332","head":{"label":"acrewdson:checkmarx-builder-fixes","ref":"checkmarx-builder-fixes","sha":"f7bf25fef7827e1ec80a78345d3b5054629e3332","user":{"login":"acrewdson","id":10353074,"avatar_url":"https://avatars0.githubusercontent.com/u/10353074?v=4","gravatar_id":"","url":"https://api.github.com/users/acrewdson","html_url":"https://github.com/acrewdson","followers_url":"https://api.github.com/users/acrewdson/followers","following_url":"https://api.github.com/users/acrewdson/following{/other_user}","gists_url":"https://api.github.com/users/acrewdson/gists{/gist_id}","starred_url":"https://api.github.com/users/acrewdson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acrewdson/subscriptions","organizations_url":"https://api.github.com/users/acrewdson/orgs","repos_url":"https://api.github.com/users/acrewdson/repos","events_url":"https://api.github.com/users/acrewdson/events{/privacy}","received_events_url":"https://api.github.com/users/acrewdson/received_events","type":"User","site_admin":false},"repo":{"id":97748751,"name":"jenkins-automation","full_name":"acrewdson/jenkins-automation","owner":{"login":"acrewdson","id":10353074,"avatar_url":"https://avatars0.githubusercontent.com/u/10353074?v=4","gravatar_id":"","url":"https://api.github.com/users/acrewdson","html_url":"https://github.com/acrewdson","followers_url":"https://api.github.com/users/acrewdson/followers","following_url":"https://api.github.com/users/acrewdson/following{/other_user}","gists_url":"https://api.github.com/users/acrewdson/gists{/gist_id}","starred_url":"https://api.github.com/users/acrewdson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acrewdson/subscriptions","organizations_url":"https://api.github.com/users/acrewdson/orgs","repos_url":"https://api.github.com/users/acrewdson/repos","events_url":"https://api.github.com/users/acrewdson/events{/privacy}","received_events_url":"https://api.github.com/users/acrewdson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/acrewdson/jenkins-automation","description":"Helpers for automating Jenkins via Groovy code—primarily job builders and utilities.","fork":true,"url":"https://api.github.com/repos/acrewdson/jenkins-automation","forks_url":"https://api.github.com/repos/acrewdson/jenkins-automation/forks","keys_url":"https://api.github.com/repos/acrewdson/jenkins-automation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acrewdson/jenkins-automation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acrewdson/jenkins-automation/teams","hooks_url":"https://api.github.com/repos/acrewdson/jenkins-automation/hooks","issue_events_url":"https://api.github.com/repos/acrewdson/jenkins-automation/issues/events{/number}","events_url":"https://api.github.com/repos/acrewdson/jenkins-automation/events","assignees_url":"https://api.github.com/repos/acrewdson/jenkins-automation/assignees{/user}","branches_url":"https://api.github.com/repos/acrewdson/jenkins-automation/branches{/branch}","tags_url":"https://api.github.com/repos/acrewdson/jenkins-automation/tags","blobs_url":"https://api.github.com/repos/acrewdson/jenkins-automation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acrewdson/jenkins-automation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acrewdson/jenkins-automation/git/refs{/sha}","trees_url":"https://api.github.com/repos/acrewdson/jenkins-automation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acrewdson/jenkins-automation/statuses/{sha}","languages_url":"https://api.github.com/repos/acrewdson/jenkins-automation/languages","stargazers_url":"https://api.github.com/repos/acrewdson/jenkins-automation/stargazers","contributors_url":"https://api.github.com/repos/acrewdson/jenkins-automation/contributors","subscribers_url":"https://api.github.com/repos/acrewdson/jenkins-automation/subscribers","subscription_url":"https://api.github.com/repos/acrewdson/jenkins-automation/subscription","commits_url":"https://api.github.com/repos/acrewdson/jenkins-automation/commits{/sha}","git_commits_url":"https://api.github.com/repos/acrewdson/jenkins-automation/git/commits{/sha}","comments_url":"https://api.github.com/repos/acrewdson/jenkins-automation/comments{/number}","issue_comment_url":"https://api.github.com/repos/acrewdson/jenkins-automation/issues/comments{/number}","contents_url":"https://api.github.com/repos/acrewdson/jenkins-automation/contents/{+path}","compare_url":"https://api.github.com/repos/acrewdson/jenkins-automation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acrewdson/jenkins-automation/merges","archive_url":"https://api.github.com/repos/acrewdson/jenkins-automation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acrewdson/jenkins-automation/downloads","issues_url":"https://api.github.com/repos/acrewdson/jenkins-automation/issues{/number}","pulls_url":"https://api.github.com/repos/acrewdson/jenkins-automation/pulls{/number}","milestones_url":"https://api.github.com/repos/acrewdson/jenkins-automation/milestones{/number}","notifications_url":"https://api.github.com/repos/acrewdson/jenkins-automation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acrewdson/jenkins-automation/labels{/name}","releases_url":"https://api.github.com/repos/acrewdson/jenkins-automation/releases{/id}","deployments_url":"https://api.github.com/repos/acrewdson/jenkins-automation/deployments","created_at":"2017-07-19T18:28:57Z","updated_at":"2017-07-19T18:28:59Z","pushed_at":"2017-11-16T16:49:24Z","git_url":"git://github.com/acrewdson/jenkins-automation.git","ssh_url":"git@github.com:acrewdson/jenkins-automation.git","clone_url":"https://github.com/acrewdson/jenkins-automation.git","svn_url":"https://github.com/acrewdson/jenkins-automation","homepage":"","size":1206,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cfpb:master","ref":"master","sha":"014093b18a20e4b9f85d20b3188c428937186786","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":38404799,"name":"jenkins-automation","full_name":"cfpb/jenkins-automation","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/jenkins-automation","description":"Helpers for automating Jenkins via Groovy code—primarily job builders and utilities.","fork":false,"url":"https://api.github.com/repos/cfpb/jenkins-automation","forks_url":"https://api.github.com/repos/cfpb/jenkins-automation/forks","keys_url":"https://api.github.com/repos/cfpb/jenkins-automation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/jenkins-automation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/jenkins-automation/teams","hooks_url":"https://api.github.com/repos/cfpb/jenkins-automation/hooks","issue_events_url":"https://api.github.com/repos/cfpb/jenkins-automation/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/jenkins-automation/events","assignees_url":"https://api.github.com/repos/cfpb/jenkins-automation/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/jenkins-automation/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/jenkins-automation/tags","blobs_url":"https://api.github.com/repos/cfpb/jenkins-automation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/jenkins-automation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/jenkins-automation/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/jenkins-automation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/jenkins-automation/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/jenkins-automation/languages","stargazers_url":"https://api.github.com/repos/cfpb/jenkins-automation/stargazers","contributors_url":"https://api.github.com/repos/cfpb/jenkins-automation/contributors","subscribers_url":"https://api.github.com/repos/cfpb/jenkins-automation/subscribers","subscription_url":"https://api.github.com/repos/cfpb/jenkins-automation/subscription","commits_url":"https://api.github.com/repos/cfpb/jenkins-automation/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/jenkins-automation/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/jenkins-automation/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/jenkins-automation/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/jenkins-automation/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/jenkins-automation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/jenkins-automation/merges","archive_url":"https://api.github.com/repos/cfpb/jenkins-automation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/jenkins-automation/downloads","issues_url":"https://api.github.com/repos/cfpb/jenkins-automation/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/jenkins-automation/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/jenkins-automation/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/jenkins-automation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/jenkins-automation/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/jenkins-automation/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/jenkins-automation/deployments","created_at":"2015-07-02T01:42:38Z","updated_at":"2017-10-30T09:15:44Z","pushed_at":"2017-11-16T16:49:25Z","git_url":"git://github.com/cfpb/jenkins-automation.git","ssh_url":"git@github.com:cfpb/jenkins-automation.git","clone_url":"https://github.com/cfpb/jenkins-automation.git","svn_url":"https://github.com/cfpb/jenkins-automation","homepage":"","size":1203,"stargazers_count":46,"watchers_count":46,"language":"Groovy","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":4,"forks":39,"open_issues":4,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119"},"html":{"href":"https://github.com/cfpb/jenkins-automation/pull/119"},"issue":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/issues/119"},"comments":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/jenkins-automation/statuses/f7bf25fef7827e1ec80a78345d3b5054629e3332"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"champain"}}