Follow-up from "Fix confirm override in gitlab:truncate_logs task"
The following discussion from !2284 (merged) should be addressed:
-
@toupeira started a discussion: (+1 comment) question: I'm not sure if the
|| !GDK::Output.interactive?
part is correct here.It looks like we copied it from https://gitlab.com/gitlab-org/gitlab-development-kit/blob/b40072ef35e60ccdee1b3745f6807079e78d6ff3/lib/gdk/command/cleanup.rb#L23, but there it makes sense because we're returning from the
continue?
method, so if the output is non-interactive we still continue and won't ask for confirmation.It seems like we'd want the same behaviour for the Rake task? Something like:
if args[:prompt] != 'false' && GDK::Output.interactive? GDK::Output.warn("About to truncate gitlab/log/* files.") GDK::Output.puts(stderr: true) next if ENV.fetch('GDK_GITLAB_TRUNCATE_LOGS_CONFIRM', 'false') == 'true'
But maybe the intention was different here, and we only want to continue when running non-interactively with an explicit
gitlab:truncate_logs[false]
?🤔 I'm also not really sure why we have two methods to disable confirmation (
args[:prompt] = 'false'
andGDK_GITLAB_TRUNCATE_LOGS_CONFIRM=true
).