{"action":"created","comment":{"url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/comments/72160454","id":72160454,"diff_hunk":"@@ -0,0 +1,51 @@\n+\n+\n+package com.docker.projects;\n+\n+// Add the following code to any Jenkinsfile.\n+// It will return with success if there are no changes in the specified docs dir\n+// and Will return with success if run on a non Pull Request branch\n+\n+// def docs = new com.docker.projects.Documentation()\n+// docs.documentationPRChecker(\"docs\")\n+\n+// docsDir ~~ the subdirectory within your repo that the documentation resides\n+def documentationPRChecker(docsDir) {\n+  if (env.CHANGE_ID != null) {\n+    stage \"docs PR checker\"\n+\n+    tokens = \"${env.JOB_NAME}\".tokenize('/')\n+    org = tokens[0]\n+    repo = tokens[1]\n+    branch = tokens[2]\n+    sh \"git log --format='%H' -1 > tempoutput\"\n+    sha = readFile(\"tempoutput\").trim()\n+    imageName = \"${repo}:${branch}\"\n+    containerName = \"${repo}-${branch}-${env.BUILD_ID}\"\n+\n+    sh \"env > env.txt\" // in case I need to debug\n+\n+    sh \"git log origin/master..${sha} ${docsDir} > tempoutput\"\n+    changes = readFile(\"tempoutput\").trim()\n+    if (changes.size() == 0) {\n+      echo \"no changes found in ${docsDir}\"\n+    } else {\n+      echo changes\n+      //slackSend channel: \"#docs-automation\", message: \"Starting docs test of <a href='${env.CHANGE_URL}'>${imageName}</a> - see <a href='${env.BUILD_URL}console'>console</a>\"\n+      //setGitHubPullRequestStatus message: \"starting docs test\"\n+      sh \"docker pull docs/base:oss\"\n+      dir(docsDir) {\n+        sh \"docker build -t ${imageName} .\"\n+      }\n+      sh \"docker run --name=${containerName} ${imageName}\"\n+\n+      // TODO: summarize the changes & errors (these are files used by GHPRB and the summary plugin\n+      sh \"docker cp ${containerName}:/validate.junit.xml .\"\n+      sh \"docker cp ${containerName}:/docs/markdownlint.summary.txt .\"\n+\n+      //setGitHubPullRequestStatus message: \"docs test complete\"\n+\n+      sh \"docker rm -f ${containerName}\"","path":"src/com/docker/projects/Documentation.groovy","position":48,"original_position":48,"commit_id":"3d00fee169b655558bd3533082cf852d2af2a1b7","original_commit_id":"3d00fee169b655558bd3533082cf852d2af2a1b7","user":{"login":"SvenDowideit","id":28492,"avatar_url":"https://avatars.githubusercontent.com/u/28492?v=3","gravatar_id":"","url":"https://api.github.com/users/SvenDowideit","html_url":"https://github.com/SvenDowideit","followers_url":"https://api.github.com/users/SvenDowideit/followers","following_url":"https://api.github.com/users/SvenDowideit/following{/other_user}","gists_url":"https://api.github.com/users/SvenDowideit/gists{/gist_id}","starred_url":"https://api.github.com/users/SvenDowideit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SvenDowideit/subscriptions","organizations_url":"https://api.github.com/users/SvenDowideit/orgs","repos_url":"https://api.github.com/users/SvenDowideit/repos","events_url":"https://api.github.com/users/SvenDowideit/events{/privacy}","received_events_url":"https://api.github.com/users/SvenDowideit/received_events","type":"User","site_admin":false},"body":"ah, I was hoping for a `defer` :) merci","created_at":"2016-07-25T22:58:03Z","updated_at":"2016-07-25T22:58:03Z","html_url":"https://github.com/docker/jenkins-pipeline-scripts/pull/2#discussion_r72160454","pull_request_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/comments/72160454"},"html":{"href":"https://github.com/docker/jenkins-pipeline-scripts/pull/2#discussion_r72160454"},"pull_request":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2","id":78621551,"html_url":"https://github.com/docker/jenkins-pipeline-scripts/pull/2","diff_url":"https://github.com/docker/jenkins-pipeline-scripts/pull/2.diff","patch_url":"https://github.com/docker/jenkins-pipeline-scripts/pull/2.patch","issue_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/2","number":2,"state":"open","locked":false,"title":"Add a global function to allow us to hook up PR checkers to all repos","user":{"login":"SvenDowideit","id":28492,"avatar_url":"https://avatars.githubusercontent.com/u/28492?v=3","gravatar_id":"","url":"https://api.github.com/users/SvenDowideit","html_url":"https://github.com/SvenDowideit","followers_url":"https://api.github.com/users/SvenDowideit/followers","following_url":"https://api.github.com/users/SvenDowideit/following{/other_user}","gists_url":"https://api.github.com/users/SvenDowideit/gists{/gist_id}","starred_url":"https://api.github.com/users/SvenDowideit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SvenDowideit/subscriptions","organizations_url":"https://api.github.com/users/SvenDowideit/orgs","repos_url":"https://api.github.com/users/SvenDowideit/repos","events_url":"https://api.github.com/users/SvenDowideit/events{/privacy}","received_events_url":"https://api.github.com/users/SvenDowideit/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>\r\n\r\n@mikedougherty I'd like to migrate all the custom jobs :)","created_at":"2016-07-25T03:16:53Z","updated_at":"2016-07-25T22:58:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c354607749e4f53c385984da8396ce4a3d9da85f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2/commits","review_comments_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2/comments","review_comment_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/2/comments","statuses_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/statuses/3d00fee169b655558bd3533082cf852d2af2a1b7","head":{"label":"SvenDowideit:add-docs-checker-function","ref":"add-docs-checker-function","sha":"3d00fee169b655558bd3533082cf852d2af2a1b7","user":{"login":"SvenDowideit","id":28492,"avatar_url":"https://avatars.githubusercontent.com/u/28492?v=3","gravatar_id":"","url":"https://api.github.com/users/SvenDowideit","html_url":"https://github.com/SvenDowideit","followers_url":"https://api.github.com/users/SvenDowideit/followers","following_url":"https://api.github.com/users/SvenDowideit/following{/other_user}","gists_url":"https://api.github.com/users/SvenDowideit/gists{/gist_id}","starred_url":"https://api.github.com/users/SvenDowideit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SvenDowideit/subscriptions","organizations_url":"https://api.github.com/users/SvenDowideit/orgs","repos_url":"https://api.github.com/users/SvenDowideit/repos","events_url":"https://api.github.com/users/SvenDowideit/events{/privacy}","received_events_url":"https://api.github.com/users/SvenDowideit/received_events","type":"User","site_admin":false},"repo":{"id":64099575,"name":"jenkins-pipeline-scripts","full_name":"SvenDowideit/jenkins-pipeline-scripts","owner":{"login":"SvenDowideit","id":28492,"avatar_url":"https://avatars.githubusercontent.com/u/28492?v=3","gravatar_id":"","url":"https://api.github.com/users/SvenDowideit","html_url":"https://github.com/SvenDowideit","followers_url":"https://api.github.com/users/SvenDowideit/followers","following_url":"https://api.github.com/users/SvenDowideit/following{/other_user}","gists_url":"https://api.github.com/users/SvenDowideit/gists{/gist_id}","starred_url":"https://api.github.com/users/SvenDowideit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SvenDowideit/subscriptions","organizations_url":"https://api.github.com/users/SvenDowideit/orgs","repos_url":"https://api.github.com/users/SvenDowideit/repos","events_url":"https://api.github.com/users/SvenDowideit/events{/privacy}","received_events_url":"https://api.github.com/users/SvenDowideit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SvenDowideit/jenkins-pipeline-scripts","description":null,"fork":true,"url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts","forks_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/forks","keys_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/teams","hooks_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/hooks","issue_events_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/events","assignees_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/tags","blobs_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/languages","stargazers_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/stargazers","contributors_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/contributors","subscribers_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/subscribers","subscription_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/subscription","commits_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/merges","archive_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/downloads","issues_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/labels{/name}","releases_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/SvenDowideit/jenkins-pipeline-scripts/deployments","created_at":"2016-07-25T03:04:55Z","updated_at":"2016-07-25T03:04:56Z","pushed_at":"2016-07-25T03:34:33Z","git_url":"git://github.com/SvenDowideit/jenkins-pipeline-scripts.git","ssh_url":"git@github.com:SvenDowideit/jenkins-pipeline-scripts.git","clone_url":"https://github.com/SvenDowideit/jenkins-pipeline-scripts.git","svn_url":"https://github.com/SvenDowideit/jenkins-pipeline-scripts","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"docker:master","ref":"master","sha":"10e218f1cd35deb47296c8c213a82887161e017f","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":56191344,"name":"jenkins-pipeline-scripts","full_name":"docker/jenkins-pipeline-scripts","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/jenkins-pipeline-scripts","description":"","fork":false,"url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts","forks_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/forks","keys_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/teams","hooks_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/hooks","issue_events_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/events","assignees_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/tags","blobs_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/languages","stargazers_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/stargazers","contributors_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/contributors","subscribers_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/subscribers","subscription_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/subscription","commits_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/merges","archive_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/downloads","issues_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/labels{/name}","releases_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/deployments","created_at":"2016-04-13T22:54:03Z","updated_at":"2016-07-25T09:24:03Z","pushed_at":"2016-07-25T03:34:33Z","git_url":"git://github.com/docker/jenkins-pipeline-scripts.git","ssh_url":"git@github.com:docker/jenkins-pipeline-scripts.git","clone_url":"https://github.com/docker/jenkins-pipeline-scripts.git","svn_url":"https://github.com/docker/jenkins-pipeline-scripts","homepage":null,"size":25,"stargazers_count":23,"watchers_count":23,"language":"Groovy","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2"},"html":{"href":"https://github.com/docker/jenkins-pipeline-scripts/pull/2"},"issue":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/2"},"comments":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/docker/jenkins-pipeline-scripts/statuses/3d00fee169b655558bd3533082cf852d2af2a1b7"}}}}
{"actor":{"display_login":"SvenDowideit"}}