Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear build dir on thumbot retry #61

Merged
merged 3 commits into from
Dec 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/thumbs/pull_request_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,10 @@ def comment_code_approvals
code_reviews
end

def remove_build_dir
FileUtils.mv(@build_dir, "#{@build_dir}.#{DateTime.now.strftime("%s")}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps move to /tmp instead?

Copy link
Contributor Author

@davidx davidx Dec 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, its already in tmp :) (by default, this way it'll move it relative to the toplevel build dir. /tmp/thumbs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paegun ^^ .

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see build_dir as /tmp/thumbs/<unique_dir_name> , so this will technically move the directory to be a child of the build directory, so would cause problems for projects that recursively perform actions w/i their build directory. I think it is better to move the directory up to /tmp/thumbs/garbage or the like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this will move the directory to a new name,
/tmp/thumbs/build_guid gets moved to directory /tmp/thumbs/build_guid.timestamp
So completely separate directories.
But for cleanliness and future dealing with the output cruft, I agree it should be in a special place like /tmp/thumbs/archive.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it's not a child, :)

end

def parse_thumbot_command(text_body)
result_lines = text_body.split(/\n/).grep(/^thumbot/)
return nil unless result_lines.length > 0
Expand All @@ -943,6 +947,8 @@ def run_thumbot_command(command)
def thumbot_retry
debug_message "received retry command"
unpersist_build_status
remove_build_dir
clear_build_progress_comment
set_build_progress(:in_progress)
validate
set_build_progress(:completed)
Expand Down