fix: add constraint and runtime check for provisioner logs size limit (#18893)

This PR sets a constraint of 1MB on the provisioner job logs written to
the database. This is consistent with the constraint we place on
workspace agent logs:
https://github.com/coder/coder/blob/4ac6be6d835dc36c242e35a26b584b784040bf28/coderd/database/dump.sql#L2030

It also adds a message printed to the front end about the provisioner
log overflow, and updates the message printed to the front end when
workspace startup logs exceed the max, as it was causing some customers
to think their startup script had failed to run.
This commit is contained in:
Benjamin Peinhardt
2025-07-30 19:09:53 -05:00
committed by GitHub
parent eeb0bbefb9
commit e4dc2d9418
38 changed files with 506 additions and 35 deletions
+8 -1
View File
@@ -1419,11 +1419,18 @@ CASE
WHEN (started_at IS NULL) THEN 'pending'::provisioner_job_status
ELSE 'running'::provisioner_job_status
END
END) STORED NOT NULL
END) STORED NOT NULL,
logs_length integer DEFAULT 0 NOT NULL,
logs_overflowed boolean DEFAULT false NOT NULL,
CONSTRAINT max_provisioner_logs_length CHECK ((logs_length <= 1048576))
);
COMMENT ON COLUMN provisioner_jobs.job_status IS 'Computed column to track the status of the job.';
COMMENT ON COLUMN provisioner_jobs.logs_length IS 'Total length of provisioner logs';
COMMENT ON COLUMN provisioner_jobs.logs_overflowed IS 'Whether the provisioner logs overflowed in length';
CREATE TABLE provisioner_keys (
id uuid NOT NULL,
created_at timestamp with time zone NOT NULL,