{"action":"created","comment":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/comments/75378618","id":75378618,"diff_hunk":"@@ -0,0 +1,87 @@\n+summary: Check that `snap run` can actually run hooks\n+\n+prepare: |\n+    echo \"Ensure we have a core snap with snap run\"\n+    $SPREAD_PATH/tests/lib/reset.sh\n+    snap install --channel=candidate ubuntu-core\n+    snapbuild $TESTSLIB/snaps/basic-hooks .\n+    snap install basic-hooks_1.0_all.snap\n+\n+    # We want to use the in-tree snap-exec, not the one in the core snap. To\n+    # accomplish that, we'll just unpack the core we just grabbed, shove the new\n+    # snap-exec in there, and repack it.\n+\n+    # First of all, unmount the core\n+    systemctl stop snapd.service\n+    core=\"$(realpath /snap/ubuntu-core/current)\"\n+    snap=\"$(mount | grep \"$core\" | awk '{print $1}')\"\n+    umount \"$core\"\n+\n+    # Now unpack the core, inject the new snap-exec into it, and repack it.\n+    unsquashfs \"$snap\"\n+    cp /usr/lib/snapd/snap-exec squashfs-root/usr/lib/snapd/\n+    mv \"$snap\" \"${snap}.orig\"\n+    mksquashfs squashfs-root \"$snap\" -comp xz\n+\n+    # Now mount the new core snap\n+    mount \"$snap\" \"$core\"\n+    systemctl start snapd.service\n+\n+    # Make sure we're running with the correct snap-exec\n+    if ! cmp /usr/lib/snapd/snap-exec ${core}/usr/lib/snapd/snap-exec; then\n+        echo \"snap-exec in tree and snap-exec in core snap are unexpectedly not the same\"\n+        exit 1\n+    fi\n+\n+restore: |\n+    rm basic-hooks_1.0_all.snap\n+\n+    # Unmount the modified core snap, and put the old one back in place\n+    systemctl stop snapd.service\n+    core=\"$(realpath /snap/ubuntu-core/current)\"\n+    snap=\"$(mount | grep \"$core\" | awk '{print $1}')\"\n+    umount \"$core\"\n+    mv \"${snap}.orig\" \"$snap\"\n+    mount \"$snap\" \"$core\"\n+    systemctl start snapd.service\n+\n+execute: |\n+    # Note that `snap run` doesn't exit non-zero if the hook is missing, so we\n+    # check the output instead.\n+\n+    echo \"Test that snap run can call valid hooks\"\n+\n+    if ! output=\"$(snap run --hook=apply-config basic-hooks)\"; then","path":"tests/main/snap-run-hook/task.yaml","position":54,"original_position":54,"commit_id":"17d04032d524f74ba004cf6a7f7c676d1992055f","original_commit_id":"17d04032d524f74ba004cf6a7f7c676d1992055f","user":{"login":"niemeyer","id":378683,"avatar_url":"https://avatars.githubusercontent.com/u/378683?v=3","gravatar_id":"","url":"https://api.github.com/users/niemeyer","html_url":"https://github.com/niemeyer","followers_url":"https://api.github.com/users/niemeyer/followers","following_url":"https://api.github.com/users/niemeyer/following{/other_user}","gists_url":"https://api.github.com/users/niemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/niemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niemeyer/subscriptions","organizations_url":"https://api.github.com/users/niemeyer/orgs","repos_url":"https://api.github.com/users/niemeyer/repos","events_url":"https://api.github.com/users/niemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/niemeyer/received_events","type":"User","site_admin":false},"body":"Erm, nevermind.. it's used below, sorry.","created_at":"2016-08-18T20:02:11Z","updated_at":"2016-08-18T20:02:11Z","html_url":"https://github.com/snapcore/snapd/pull/1681#discussion_r75378618","pull_request_url":"https://api.github.com/repos/snapcore/snapd/pulls/1681","_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments/75378618"},"html":{"href":"https://github.com/snapcore/snapd/pull/1681#discussion_r75378618"},"pull_request":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1681"}}},"pull_request":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/1681","id":81391518,"html_url":"https://github.com/snapcore/snapd/pull/1681","diff_url":"https://github.com/snapcore/snapd/pull/1681.diff","patch_url":"https://github.com/snapcore/snapd/pull/1681.patch","issue_url":"https://api.github.com/repos/snapcore/snapd/issues/1681","number":1681,"state":"open","locked":false,"title":"tests: test `snap run --hook` using in-tree snap-exec.","user":{"login":"kyrofa","id":946674,"avatar_url":"https://avatars.githubusercontent.com/u/946674?v=3","gravatar_id":"","url":"https://api.github.com/users/kyrofa","html_url":"https://github.com/kyrofa","followers_url":"https://api.github.com/users/kyrofa/followers","following_url":"https://api.github.com/users/kyrofa/following{/other_user}","gists_url":"https://api.github.com/users/kyrofa/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrofa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrofa/subscriptions","organizations_url":"https://api.github.com/users/kyrofa/orgs","repos_url":"https://api.github.com/users/kyrofa/repos","events_url":"https://api.github.com/users/kyrofa/events{/privacy}","received_events_url":"https://api.github.com/users/kyrofa/received_events","type":"User","site_admin":false},"body":"This PR adds a simple spread test for `snap run --hook` that uses the in-tree snap-exec instead of the one contained within the core snap. This will hopefully prevent future regressions from being introduced into the `snap run --hook` code as well as snap-exec.","created_at":"2016-08-15T23:14:01Z","updated_at":"2016-08-18T20:02:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5524b1d07bc10e72b4728552c2a0b1966d24acf0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/snapcore/snapd/pulls/1681/commits","review_comments_url":"https://api.github.com/repos/snapcore/snapd/pulls/1681/comments","review_comment_url":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snapcore/snapd/issues/1681/comments","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/17d04032d524f74ba004cf6a7f7c676d1992055f","head":{"label":"kyrofa:feature/add_snap-exec_spread_tests","ref":"feature/add_snap-exec_spread_tests","sha":"17d04032d524f74ba004cf6a7f7c676d1992055f","user":{"login":"kyrofa","id":946674,"avatar_url":"https://avatars.githubusercontent.com/u/946674?v=3","gravatar_id":"","url":"https://api.github.com/users/kyrofa","html_url":"https://github.com/kyrofa","followers_url":"https://api.github.com/users/kyrofa/followers","following_url":"https://api.github.com/users/kyrofa/following{/other_user}","gists_url":"https://api.github.com/users/kyrofa/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrofa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrofa/subscriptions","organizations_url":"https://api.github.com/users/kyrofa/orgs","repos_url":"https://api.github.com/users/kyrofa/repos","events_url":"https://api.github.com/users/kyrofa/events{/privacy}","received_events_url":"https://api.github.com/users/kyrofa/received_events","type":"User","site_admin":false},"repo":{"id":59755219,"name":"snapd","full_name":"kyrofa/snapd","owner":{"login":"kyrofa","id":946674,"avatar_url":"https://avatars.githubusercontent.com/u/946674?v=3","gravatar_id":"","url":"https://api.github.com/users/kyrofa","html_url":"https://github.com/kyrofa","followers_url":"https://api.github.com/users/kyrofa/followers","following_url":"https://api.github.com/users/kyrofa/following{/other_user}","gists_url":"https://api.github.com/users/kyrofa/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrofa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrofa/subscriptions","organizations_url":"https://api.github.com/users/kyrofa/orgs","repos_url":"https://api.github.com/users/kyrofa/repos","events_url":"https://api.github.com/users/kyrofa/events{/privacy}","received_events_url":"https://api.github.com/users/kyrofa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kyrofa/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":true,"url":"https://api.github.com/repos/kyrofa/snapd","forks_url":"https://api.github.com/repos/kyrofa/snapd/forks","keys_url":"https://api.github.com/repos/kyrofa/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kyrofa/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kyrofa/snapd/teams","hooks_url":"https://api.github.com/repos/kyrofa/snapd/hooks","issue_events_url":"https://api.github.com/repos/kyrofa/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/kyrofa/snapd/events","assignees_url":"https://api.github.com/repos/kyrofa/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/kyrofa/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/kyrofa/snapd/tags","blobs_url":"https://api.github.com/repos/kyrofa/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kyrofa/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kyrofa/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/kyrofa/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kyrofa/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/kyrofa/snapd/languages","stargazers_url":"https://api.github.com/repos/kyrofa/snapd/stargazers","contributors_url":"https://api.github.com/repos/kyrofa/snapd/contributors","subscribers_url":"https://api.github.com/repos/kyrofa/snapd/subscribers","subscription_url":"https://api.github.com/repos/kyrofa/snapd/subscription","commits_url":"https://api.github.com/repos/kyrofa/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/kyrofa/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/kyrofa/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/kyrofa/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/kyrofa/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/kyrofa/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kyrofa/snapd/merges","archive_url":"https://api.github.com/repos/kyrofa/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kyrofa/snapd/downloads","issues_url":"https://api.github.com/repos/kyrofa/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/kyrofa/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/kyrofa/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/kyrofa/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kyrofa/snapd/labels{/name}","releases_url":"https://api.github.com/repos/kyrofa/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/kyrofa/snapd/deployments","created_at":"2016-05-26T14:05:43Z","updated_at":"2016-05-26T14:05:46Z","pushed_at":"2016-08-18T19:25:43Z","git_url":"git://github.com/kyrofa/snapd.git","ssh_url":"git@github.com:kyrofa/snapd.git","clone_url":"https://github.com/kyrofa/snapd.git","svn_url":"https://github.com/kyrofa/snapd","homepage":"","size":33822,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"snapcore:master","ref":"master","sha":"1f99ee105be43cdeb146ff23be024e8ce943acf2","user":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snapd","full_name":"snapcore/snapd","owner":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snapcore/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":false,"url":"https://api.github.com/repos/snapcore/snapd","forks_url":"https://api.github.com/repos/snapcore/snapd/forks","keys_url":"https://api.github.com/repos/snapcore/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snapcore/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snapcore/snapd/teams","hooks_url":"https://api.github.com/repos/snapcore/snapd/hooks","issue_events_url":"https://api.github.com/repos/snapcore/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/snapcore/snapd/events","assignees_url":"https://api.github.com/repos/snapcore/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/snapcore/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/snapcore/snapd/tags","blobs_url":"https://api.github.com/repos/snapcore/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snapcore/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snapcore/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/snapcore/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/snapcore/snapd/languages","stargazers_url":"https://api.github.com/repos/snapcore/snapd/stargazers","contributors_url":"https://api.github.com/repos/snapcore/snapd/contributors","subscribers_url":"https://api.github.com/repos/snapcore/snapd/subscribers","subscription_url":"https://api.github.com/repos/snapcore/snapd/subscription","commits_url":"https://api.github.com/repos/snapcore/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/snapcore/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/snapcore/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/snapcore/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/snapcore/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/snapcore/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snapcore/snapd/merges","archive_url":"https://api.github.com/repos/snapcore/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snapcore/snapd/downloads","issues_url":"https://api.github.com/repos/snapcore/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/snapcore/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/snapcore/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/snapcore/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snapcore/snapd/labels{/name}","releases_url":"https://api.github.com/repos/snapcore/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/snapcore/snapd/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2016-08-18T19:55:32Z","pushed_at":"2016-08-18T19:25:43Z","git_url":"git://github.com/snapcore/snapd.git","ssh_url":"git@github.com:snapcore/snapd.git","clone_url":"https://github.com/snapcore/snapd.git","svn_url":"https://github.com/snapcore/snapd","homepage":"","size":35679,"stargazers_count":378,"watchers_count":378,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":91,"mirror_url":null,"open_issues_count":30,"forks":91,"open_issues":30,"watchers":378,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1681"},"html":{"href":"https://github.com/snapcore/snapd/pull/1681"},"issue":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1681"},"comments":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1681/comments"},"review_comments":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1681/comments"},"review_comment":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1681/commits"},"statuses":{"href":"https://api.github.com/repos/snapcore/snapd/statuses/17d04032d524f74ba004cf6a7f7c676d1992055f"}}}}
{"actor":{"display_login":"niemeyer"}}