{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/comments/223843038","pull_request_review_id":163071411,"id":223843038,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzg0MzAzOA==","diff_hunk":"@@ -172,16 +176,11 @@ touch .build-commit\n mv -T ${tmp_builddir} ${buildid}\n # Replace the latest link\n ln -Tsfr \"${buildid}\" latest\n-python3 -c 'import os,json,sys,stat;\n-builds=[]\n-for d in os.listdir(\".\"):\n-  s = os.lstat(d)\n-  if not (stat.S_ISDIR(s.st_mode) and os.path.isfile(d + \"/meta.json\")):\n-    continue\n-  builds.append((d, s.st_ctime))\n-json.dump({\"builds\":\n-           list(map(lambda x: x[0], sorted(builds, key=lambda x: x[0])))},\n-          sys.stdout)\n-' > ${workdir}/tmp/builds.json\n-mv ${workdir}/tmp/builds.json builds.json\n+# And now clean up previous builds and regen builds.json\n+KEEP_LAST_N=\n+if [ ${SKIP_PRUNE} = 1 ]; then\n+    # Really then, we're just using the `prune_builds` to regen builds.json","path":"src/cmd-build","position":39,"original_position":39,"commit_id":"4d7fdff47cf098d207533e72df0dbe6fe29ac318","original_commit_id":"4d7fdff47cf098d207533e72df0dbe6fe29ac318","user":{"login":"dustymabe","id":4530030,"node_id":"MDQ6VXNlcjQ1MzAwMzA=","avatar_url":"https://avatars2.githubusercontent.com/u/4530030?v=4","gravatar_id":"","url":"https://api.github.com/users/dustymabe","html_url":"https://github.com/dustymabe","followers_url":"https://api.github.com/users/dustymabe/followers","following_url":"https://api.github.com/users/dustymabe/following{/other_user}","gists_url":"https://api.github.com/users/dustymabe/gists{/gist_id}","starred_url":"https://api.github.com/users/dustymabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dustymabe/subscriptions","organizations_url":"https://api.github.com/users/dustymabe/orgs","repos_url":"https://api.github.com/users/dustymabe/repos","events_url":"https://api.github.com/users/dustymabe/events{/privacy}","received_events_url":"https://api.github.com/users/dustymabe/received_events","type":"User","site_admin":false},"body":"I think once we rewrite we would just be able to share the code (i.e. shared python function). The other thing you can do is not \"walk\" the structure in `prune_builds` but just read the json (generated before prune) and delete the directories, then regenerate builds.json again after prune. Then we wouldn't be duplicating code as much. \r\n\r\n> We could, though is it really worth it?\r\n\r\nI'll leave the above suggestion up to you. I was just mostly trying to think of how we could do things more cleanly. \r\n","created_at":"2018-10-09T20:02:41Z","updated_at":"2018-10-09T20:02:41Z","html_url":"https://github.com/coreos/coreos-assembler/pull/140#discussion_r223843038","pull_request_url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/comments/223843038"},"html":{"href":"https://github.com/coreos/coreos-assembler/pull/140#discussion_r223843038"},"pull_request":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140"}},"in_reply_to_id":223831616},"pull_request":{"url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140","id":219837808,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5ODM3ODA4","html_url":"https://github.com/coreos/coreos-assembler/pull/140","diff_url":"https://github.com/coreos/coreos-assembler/pull/140.diff","patch_url":"https://github.com/coreos/coreos-assembler/pull/140.patch","issue_url":"https://api.github.com/repos/coreos/coreos-assembler/issues/140","number":140,"state":"open","locked":false,"title":"build: Add artifact pruning","user":{"login":"jlebon","id":11934099,"node_id":"MDQ6VXNlcjExOTM0MDk5","avatar_url":"https://avatars3.githubusercontent.com/u/11934099?v=4","gravatar_id":"","url":"https://api.github.com/users/jlebon","html_url":"https://github.com/jlebon","followers_url":"https://api.github.com/users/jlebon/followers","following_url":"https://api.github.com/users/jlebon/following{/other_user}","gists_url":"https://api.github.com/users/jlebon/gists{/gist_id}","starred_url":"https://api.github.com/users/jlebon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlebon/subscriptions","organizations_url":"https://api.github.com/users/jlebon/orgs","repos_url":"https://api.github.com/users/jlebon/repos","events_url":"https://api.github.com/users/jlebon/events{/privacy}","received_events_url":"https://api.github.com/users/jlebon/received_events","type":"User","site_admin":false},"body":"Make `builds.json` only keep the last 3 (for now) builds and prune the\r\nOSTree repos as well.\r\n\r\nCloses: #137","created_at":"2018-10-02T20:39:51Z","updated_at":"2018-10-09T20:02:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd4879cb20de569603c805fdfc7c5ec079e4aeea","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140/commits","review_comments_url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140/comments","review_comment_url":"https://api.github.com/repos/coreos/coreos-assembler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/coreos-assembler/issues/140/comments","statuses_url":"https://api.github.com/repos/coreos/coreos-assembler/statuses/4d7fdff47cf098d207533e72df0dbe6fe29ac318","head":{"label":"jlebon:pr/prune","ref":"pr/prune","sha":"4d7fdff47cf098d207533e72df0dbe6fe29ac318","user":{"login":"jlebon","id":11934099,"node_id":"MDQ6VXNlcjExOTM0MDk5","avatar_url":"https://avatars3.githubusercontent.com/u/11934099?v=4","gravatar_id":"","url":"https://api.github.com/users/jlebon","html_url":"https://github.com/jlebon","followers_url":"https://api.github.com/users/jlebon/followers","following_url":"https://api.github.com/users/jlebon/following{/other_user}","gists_url":"https://api.github.com/users/jlebon/gists{/gist_id}","starred_url":"https://api.github.com/users/jlebon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlebon/subscriptions","organizations_url":"https://api.github.com/users/jlebon/orgs","repos_url":"https://api.github.com/users/jlebon/repos","events_url":"https://api.github.com/users/jlebon/events{/privacy}","received_events_url":"https://api.github.com/users/jlebon/received_events","type":"User","site_admin":false},"repo":{"id":134729484,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ3Mjk0ODQ=","name":"coreos-assembler","full_name":"jlebon/coreos-assembler","private":false,"owner":{"login":"jlebon","id":11934099,"node_id":"MDQ6VXNlcjExOTM0MDk5","avatar_url":"https://avatars3.githubusercontent.com/u/11934099?v=4","gravatar_id":"","url":"https://api.github.com/users/jlebon","html_url":"https://github.com/jlebon","followers_url":"https://api.github.com/users/jlebon/followers","following_url":"https://api.github.com/users/jlebon/following{/other_user}","gists_url":"https://api.github.com/users/jlebon/gists{/gist_id}","starred_url":"https://api.github.com/users/jlebon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlebon/subscriptions","organizations_url":"https://api.github.com/users/jlebon/orgs","repos_url":"https://api.github.com/users/jlebon/repos","events_url":"https://api.github.com/users/jlebon/events{/privacy}","received_events_url":"https://api.github.com/users/jlebon/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jlebon/coreos-assembler","description":"\"rpm-ostree compose tree\" as a container","fork":true,"url":"https://api.github.com/repos/jlebon/coreos-assembler","forks_url":"https://api.github.com/repos/jlebon/coreos-assembler/forks","keys_url":"https://api.github.com/repos/jlebon/coreos-assembler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlebon/coreos-assembler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlebon/coreos-assembler/teams","hooks_url":"https://api.github.com/repos/jlebon/coreos-assembler/hooks","issue_events_url":"https://api.github.com/repos/jlebon/coreos-assembler/issues/events{/number}","events_url":"https://api.github.com/repos/jlebon/coreos-assembler/events","assignees_url":"https://api.github.com/repos/jlebon/coreos-assembler/assignees{/user}","branches_url":"https://api.github.com/repos/jlebon/coreos-assembler/branches{/branch}","tags_url":"https://api.github.com/repos/jlebon/coreos-assembler/tags","blobs_url":"https://api.github.com/repos/jlebon/coreos-assembler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlebon/coreos-assembler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlebon/coreos-assembler/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlebon/coreos-assembler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlebon/coreos-assembler/statuses/{sha}","languages_url":"https://api.github.com/repos/jlebon/coreos-assembler/languages","stargazers_url":"https://api.github.com/repos/jlebon/coreos-assembler/stargazers","contributors_url":"https://api.github.com/repos/jlebon/coreos-assembler/contributors","subscribers_url":"https://api.github.com/repos/jlebon/coreos-assembler/subscribers","subscription_url":"https://api.github.com/repos/jlebon/coreos-assembler/subscription","commits_url":"https://api.github.com/repos/jlebon/coreos-assembler/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlebon/coreos-assembler/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlebon/coreos-assembler/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlebon/coreos-assembler/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlebon/coreos-assembler/contents/{+path}","compare_url":"https://api.github.com/repos/jlebon/coreos-assembler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlebon/coreos-assembler/merges","archive_url":"https://api.github.com/repos/jlebon/coreos-assembler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlebon/coreos-assembler/downloads","issues_url":"https://api.github.com/repos/jlebon/coreos-assembler/issues{/number}","pulls_url":"https://api.github.com/repos/jlebon/coreos-assembler/pulls{/number}","milestones_url":"https://api.github.com/repos/jlebon/coreos-assembler/milestones{/number}","notifications_url":"https://api.github.com/repos/jlebon/coreos-assembler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlebon/coreos-assembler/labels{/name}","releases_url":"https://api.github.com/repos/jlebon/coreos-assembler/releases{/id}","deployments_url":"https://api.github.com/repos/jlebon/coreos-assembler/deployments","created_at":"2018-05-24T14:47:20Z","updated_at":"2018-08-27T16:56:09Z","pushed_at":"2018-10-09T14:22:16Z","git_url":"git://github.com/jlebon/coreos-assembler.git","ssh_url":"git@github.com:jlebon/coreos-assembler.git","clone_url":"https://github.com/jlebon/coreos-assembler.git","svn_url":"https://github.com/jlebon/coreos-assembler","homepage":null,"size":126,"stargazers_count":0,"watchers_count":0,"language":"Rust","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,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"4bb7ee832131619ad79dfd9fd8497d6c115541a0","user":{"login":"coreos","id":3730757,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MzA3NTc=","avatar_url":"https://avatars3.githubusercontent.com/u/3730757?v=4","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":133999225,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5OTkyMjU=","name":"coreos-assembler","full_name":"coreos/coreos-assembler","private":false,"owner":{"login":"coreos","id":3730757,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MzA3NTc=","avatar_url":"https://avatars3.githubusercontent.com/u/3730757?v=4","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/coreos/coreos-assembler","description":"Tooling container to assemble CoreOS-like systems","fork":false,"url":"https://api.github.com/repos/coreos/coreos-assembler","forks_url":"https://api.github.com/repos/coreos/coreos-assembler/forks","keys_url":"https://api.github.com/repos/coreos/coreos-assembler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/coreos-assembler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/coreos-assembler/teams","hooks_url":"https://api.github.com/repos/coreos/coreos-assembler/hooks","issue_events_url":"https://api.github.com/repos/coreos/coreos-assembler/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/coreos-assembler/events","assignees_url":"https://api.github.com/repos/coreos/coreos-assembler/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/coreos-assembler/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/coreos-assembler/tags","blobs_url":"https://api.github.com/repos/coreos/coreos-assembler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/coreos-assembler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/coreos-assembler/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/coreos-assembler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/coreos-assembler/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/coreos-assembler/languages","stargazers_url":"https://api.github.com/repos/coreos/coreos-assembler/stargazers","contributors_url":"https://api.github.com/repos/coreos/coreos-assembler/contributors","subscribers_url":"https://api.github.com/repos/coreos/coreos-assembler/subscribers","subscription_url":"https://api.github.com/repos/coreos/coreos-assembler/subscription","commits_url":"https://api.github.com/repos/coreos/coreos-assembler/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/coreos-assembler/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/coreos-assembler/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/coreos-assembler/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/coreos-assembler/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/coreos-assembler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/coreos-assembler/merges","archive_url":"https://api.github.com/repos/coreos/coreos-assembler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/coreos-assembler/downloads","issues_url":"https://api.github.com/repos/coreos/coreos-assembler/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/coreos-assembler/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/coreos-assembler/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/coreos-assembler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/coreos-assembler/labels{/name}","releases_url":"https://api.github.com/repos/coreos/coreos-assembler/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/coreos-assembler/deployments","created_at":"2018-05-18T20:07:27Z","updated_at":"2018-10-09T20:00:47Z","pushed_at":"2018-10-09T20:00:45Z","git_url":"git://github.com/coreos/coreos-assembler.git","ssh_url":"git@github.com:coreos/coreos-assembler.git","clone_url":"https://github.com/coreos/coreos-assembler.git","svn_url":"https://github.com/coreos/coreos-assembler","homepage":"","size":143,"stargazers_count":15,"watchers_count":15,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":21,"license":null,"forks":14,"open_issues":21,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140"},"html":{"href":"https://github.com/coreos/coreos-assembler/pull/140"},"issue":{"href":"https://api.github.com/repos/coreos/coreos-assembler/issues/140"},"comments":{"href":"https://api.github.com/repos/coreos/coreos-assembler/issues/140/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/coreos-assembler/pulls/140/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/coreos-assembler/statuses/4d7fdff47cf098d207533e72df0dbe6fe29ac318"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dustymabe"}}