Skip to content

Commit d5df133

Browse files
committed
Pipe the scripts!
1 parent 89c7af1 commit d5df133

21 files changed

+391
-136
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,10 @@ func (q *querier) GetWorkspaceAgentMetadata(ctx context.Context, workspaceAgentI
15641564
return q.db.GetWorkspaceAgentMetadata(ctx, workspaceAgentID)
15651565
}
15661566

1567+
func (q *querier) GetWorkspaceAgentScriptsByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]database.WorkspaceAgentScript, error) {
1568+
panic("not implemented")
1569+
}
1570+
15671571
func (q *querier) GetWorkspaceAgentStats(ctx context.Context, createdAfter time.Time) ([]database.GetWorkspaceAgentStatsRow, error) {
15681572
return q.db.GetWorkspaceAgentStats(ctx, createdAfter)
15691573
}
@@ -2049,6 +2053,10 @@ func (q *querier) InsertWorkspaceAgentMetadata(ctx context.Context, arg database
20492053
return q.db.InsertWorkspaceAgentMetadata(ctx, arg)
20502054
}
20512055

2056+
func (q *querier) InsertWorkspaceAgentScripts(ctx context.Context, arg database.InsertWorkspaceAgentScriptsParams) ([]database.WorkspaceAgentScript, error) {
2057+
panic("not implemented")
2058+
}
2059+
20522060
func (q *querier) InsertWorkspaceAgentStat(ctx context.Context, arg database.InsertWorkspaceAgentStatParams) (database.WorkspaceAgentStat, error) {
20532061
// TODO: This is a workspace agent operation. Should users be able to query this?
20542062
// Not really sure what this is for.

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,8 +1487,7 @@ func (s *MethodTestSuite) TestSystemFunctions() {
14871487
}))
14881488
s.Run("InsertWorkspaceAgent", s.Subtest(func(db database.Store, check *expects) {
14891489
check.Args(database.InsertWorkspaceAgentParams{
1490-
ID: uuid.New(),
1491-
StartupScriptBehavior: database.StartupScriptBehaviorNonBlocking,
1490+
ID: uuid.New(),
14921491
}).Asserts(rbac.ResourceSystem, rbac.ActionCreate)
14931492
}))
14941493
s.Run("InsertWorkspaceApp", s.Subtest(func(db database.Store, check *expects) {

coderd/database/dbfake/dbfake.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,6 +3103,10 @@ func (q *FakeQuerier) GetWorkspaceAgentMetadata(_ context.Context, workspaceAgen
31033103
return metadata, nil
31043104
}
31053105

3106+
func (q *FakeQuerier) GetWorkspaceAgentScriptsByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]database.WorkspaceAgentScript, error) {
3107+
panic("not implemented")
3108+
}
3109+
31063110
func (q *FakeQuerier) GetWorkspaceAgentStats(_ context.Context, createdAfter time.Time) ([]database.GetWorkspaceAgentStatsRow, error) {
31073111
q.mutex.RLock()
31083112
defer q.mutex.RUnlock()
@@ -4505,6 +4509,15 @@ func (q *FakeQuerier) InsertWorkspaceAgentMetadata(_ context.Context, arg databa
45054509
return nil
45064510
}
45074511

4512+
func (q *FakeQuerier) InsertWorkspaceAgentScripts(ctx context.Context, arg database.InsertWorkspaceAgentScriptsParams) ([]database.WorkspaceAgentScript, error) {
4513+
err := validateDatabaseType(arg)
4514+
if err != nil {
4515+
return nil, err
4516+
}
4517+
4518+
panic("not implemented")
4519+
}
4520+
45084521
func (q *FakeQuerier) InsertWorkspaceAgentStat(_ context.Context, p database.InsertWorkspaceAgentStatParams) (database.WorkspaceAgentStat, error) {
45094522
if err := validateDatabaseType(p); err != nil {
45104523
return database.WorkspaceAgentStat{}, err

coderd/database/dbmetrics/dbmetrics.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbmock/dbmock.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dump.sql

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/migrations/000154_workspace_agent_script.up.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ CREATE TABLE workspace_agent_log_sources (
1111
CREATE TABLE workspace_agent_scripts (
1212
workspace_agent_id uuid NOT NULL,
1313
log_source_id uuid NOT NULL,
14+
log_source_display_name varchar(127) NOT NULL,
1415
created_at timestamptz NOT NULL,
15-
script text NOT NULL,
16-
schedule text NOT NULL,
17-
login_before_ready boolean NOT NULL,
16+
source text NOT NULL,
17+
cron text NOT NULL,
18+
start_blocks_login boolean NOT NULL,
1819
run_on_start boolean NOT NULL,
1920
run_on_stop boolean NOT NULL,
20-
name varchar(127) NOT NULL,
21-
description text NOT NULL
21+
timeout integer NOT NULL
2222
);
2323

2424
ALTER TABLE workspace_agent_logs ADD COLUMN log_source_id uuid NOT NULL;

coderd/database/models.go

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)