{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/91200548","pull_request_review_id":11710518,"id":91200548,"diff_hunk":"@@ -0,0 +1,96 @@\n+package service\n+\n+import (\n+\t\"encoding/hex\"\n+\t\"fmt\"\n+\n+\t\"github.com/Sirupsen/logrus\"\n+\t\"github.com/docker/distribution/digest\"\n+\tdistreference \"github.com/docker/distribution/reference\"\n+\t\"github.com/docker/docker/api/types/swarm\"\n+\t\"github.com/docker/docker/cli/command\"\n+\t\"github.com/docker/docker/cli/trust\"\n+\t\"github.com/docker/docker/reference\"\n+\t\"github.com/docker/docker/registry\"\n+\t\"github.com/docker/notary/tuf/data\"\n+\t\"github.com/pkg/errors\"\n+\t\"golang.org/x/net/context\"\n+)\n+\n+func resolveServiceImageDigest(dockerCli *command.DockerCli, service *swarm.ServiceSpec) error {\n+\tif !command.IsTrusted() {\n+\t\t// Digests are resolved by the daemon when not using content\n+\t\t// trust.\n+\t\treturn nil\n+\t}\n+\n+\timage := service.TaskTemplate.ContainerSpec.Image\n+\n+\t// We only attempt to resolve the digest if the reference\n+\t// could be parsed as a digest reference. Specifying an image ID","path":"cli/command/service/trust.go","position":30,"original_position":30,"commit_id":"0182c9a6d8d90cfa0d793142d98619948e7d332c","original_commit_id":"dfbfdcdf81e086c8724a4fef8ab1c566efab9685","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"It's what you see under `Id` in `docker inspect`. An example is:\r\n\r\n```\r\nsha256:a95d886ecdf2cda6a61eef160ca61be49c56d005c7b5fec048706e4a12e53eb7\r\n```\r\n\r\nIn other words, if the digest package validates it as a digest, we treat it as a content-addressable image ID. Since neither notary nor registry can fetch images by their ID, this avoids talking to notary/registry to query it. Images referenced in this way will only work if the image already exists locally.","created_at":"2016-12-06T23:57:33Z","updated_at":"2016-12-06T23:57:33Z","html_url":"https://github.com/docker/docker/pull/29156#discussion_r91200548","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/29156","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/91200548"},"html":{"href":"https://github.com/docker/docker/pull/29156#discussion_r91200548"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/29156"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/29156","id":96641873,"html_url":"https://github.com/docker/docker/pull/29156","diff_url":"https://github.com/docker/docker/pull/29156.diff","patch_url":"https://github.com/docker/docker/pull/29156.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/29156","number":29156,"state":"open","locked":false,"title":"Content trust for swarm services","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"- Refactor cli trust code to split generally useful functions and variables out of `cli/command/image`.\r\n- Implement digest pinning using notary for \"service create\" and \"service update\".\r\n\r\nTested manually, but needs integration tests before it can go in.\r\n\r\ncc @nishanttotla @diogomonica @cyli @endophage","created_at":"2016-12-06T01:05:02Z","updated_at":"2016-12-06T23:57:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bcc6ad5e1eebe6e4f338137cad7ba31331b8ef6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/29156/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/29156/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/29156/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/0182c9a6d8d90cfa0d793142d98619948e7d332c","head":{"label":"aaronlehmann:trusted-service-create","ref":"trusted-service-create","sha":"0182c9a6d8d90cfa0d793142d98619948e7d332c","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"repo":{"id":39463499,"name":"docker","full_name":"aaronlehmann/docker","owner":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aaronlehmann/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/aaronlehmann/docker","forks_url":"https://api.github.com/repos/aaronlehmann/docker/forks","keys_url":"https://api.github.com/repos/aaronlehmann/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aaronlehmann/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aaronlehmann/docker/teams","hooks_url":"https://api.github.com/repos/aaronlehmann/docker/hooks","issue_events_url":"https://api.github.com/repos/aaronlehmann/docker/issues/events{/number}","events_url":"https://api.github.com/repos/aaronlehmann/docker/events","assignees_url":"https://api.github.com/repos/aaronlehmann/docker/assignees{/user}","branches_url":"https://api.github.com/repos/aaronlehmann/docker/branches{/branch}","tags_url":"https://api.github.com/repos/aaronlehmann/docker/tags","blobs_url":"https://api.github.com/repos/aaronlehmann/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aaronlehmann/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aaronlehmann/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/aaronlehmann/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aaronlehmann/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/aaronlehmann/docker/languages","stargazers_url":"https://api.github.com/repos/aaronlehmann/docker/stargazers","contributors_url":"https://api.github.com/repos/aaronlehmann/docker/contributors","subscribers_url":"https://api.github.com/repos/aaronlehmann/docker/subscribers","subscription_url":"https://api.github.com/repos/aaronlehmann/docker/subscription","commits_url":"https://api.github.com/repos/aaronlehmann/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/aaronlehmann/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/aaronlehmann/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/aaronlehmann/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/aaronlehmann/docker/contents/{+path}","compare_url":"https://api.github.com/repos/aaronlehmann/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aaronlehmann/docker/merges","archive_url":"https://api.github.com/repos/aaronlehmann/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aaronlehmann/docker/downloads","issues_url":"https://api.github.com/repos/aaronlehmann/docker/issues{/number}","pulls_url":"https://api.github.com/repos/aaronlehmann/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/aaronlehmann/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/aaronlehmann/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aaronlehmann/docker/labels{/name}","releases_url":"https://api.github.com/repos/aaronlehmann/docker/releases{/id}","deployments_url":"https://api.github.com/repos/aaronlehmann/docker/deployments","created_at":"2015-07-21T18:44:59Z","updated_at":"2016-01-14T00:46:21Z","pushed_at":"2016-12-06T23:54:43Z","git_url":"git://github.com/aaronlehmann/docker.git","ssh_url":"git@github.com:aaronlehmann/docker.git","clone_url":"https://github.com/aaronlehmann/docker.git","svn_url":"https://github.com/aaronlehmann/docker","homepage":"http://www.docker.com","size":115703,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"eefbf1ddd3ee4e6b6e6dc7e938e77a96ceb40163","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":7691631,"name":"docker","full_name":"docker/docker","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/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","deployments_url":"https://api.github.com/repos/docker/docker/deployments","created_at":"2013-01-18T18:10:57Z","updated_at":"2016-12-06T23:36:32Z","pushed_at":"2016-12-06T23:54:44Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":227424,"stargazers_count":37567,"watchers_count":37567,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11153,"mirror_url":null,"open_issues_count":1982,"forks":11153,"open_issues":1982,"watchers":37567,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/29156"},"html":{"href":"https://github.com/docker/docker/pull/29156"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/29156"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/29156/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/29156/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/29156/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/0182c9a6d8d90cfa0d793142d98619948e7d332c"}}}}
{"actor":{"display_login":"aaronlehmann"}}