Skip to content

Commit c06ef7c

Browse files
authored
chore!: remove JFrog integration (coder#17353)
- Removes displaying XRay scan results in the dashboard. I'm not sure anyone was even using this integration so it's just debt for us to maintain. We can open up a separate issue to get rid of the db tables once we know for sure that we haven't broken anyone.
1 parent 15584e6 commit c06ef7c

File tree

23 files changed

+2
-1102
lines changed

23 files changed

+2
-1102
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/dbauthz/dbauthz.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,13 +1895,6 @@ func (q *querier) GetInboxNotificationsByUserID(ctx context.Context, userID data
18951895
return fetchWithPostFilter(q.auth, policy.ActionRead, q.db.GetInboxNotificationsByUserID)(ctx, userID)
18961896
}
18971897

1898-
func (q *querier) GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.GetJFrogXrayScanByWorkspaceAndAgentIDParams) (database.JfrogXrayScan, error) {
1899-
if _, err := fetch(q.log, q.auth, q.db.GetWorkspaceByID)(ctx, arg.WorkspaceID); err != nil {
1900-
return database.JfrogXrayScan{}, err
1901-
}
1902-
return q.db.GetJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
1903-
}
1904-
19051898
func (q *querier) GetLastUpdateCheck(ctx context.Context) (string, error) {
19061899
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {
19071900
return "", err
@@ -4767,27 +4760,6 @@ func (q *querier) UpsertHealthSettings(ctx context.Context, value string) error
47674760
return q.db.UpsertHealthSettings(ctx, value)
47684761
}
47694762

4770-
func (q *querier) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
4771-
// TODO: Having to do all this extra querying makes me a sad panda.
4772-
workspace, err := q.db.GetWorkspaceByID(ctx, arg.WorkspaceID)
4773-
if err != nil {
4774-
return xerrors.Errorf("get workspace by id: %w", err)
4775-
}
4776-
4777-
template, err := q.db.GetTemplateByID(ctx, workspace.TemplateID)
4778-
if err != nil {
4779-
return xerrors.Errorf("get template by id: %w", err)
4780-
}
4781-
4782-
// Only template admins should be able to write JFrog Xray scans to a workspace.
4783-
// We don't want this to be a workspace-level permission because then users
4784-
// could overwrite their own results.
4785-
if err := q.authorizeContext(ctx, policy.ActionCreate, template); err != nil {
4786-
return err
4787-
}
4788-
return q.db.UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
4789-
}
4790-
47914763
func (q *querier) UpsertLastUpdateCheck(ctx context.Context, value string) error {
47924764
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceSystem); err != nil {
47934765
return err

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4293,74 +4293,6 @@ func (s *MethodTestSuite) TestSystemFunctions() {
42934293
s.Run("GetUserLinksByUserID", s.Subtest(func(db database.Store, check *expects) {
42944294
check.Args(uuid.New()).Asserts(rbac.ResourceSystem, policy.ActionRead)
42954295
}))
4296-
s.Run("GetJFrogXrayScanByWorkspaceAndAgentID", s.Subtest(func(db database.Store, check *expects) {
4297-
u := dbgen.User(s.T(), db, database.User{})
4298-
org := dbgen.Organization(s.T(), db, database.Organization{})
4299-
tpl := dbgen.Template(s.T(), db, database.Template{
4300-
OrganizationID: org.ID,
4301-
CreatedBy: u.ID,
4302-
})
4303-
ws := dbgen.Workspace(s.T(), db, database.WorkspaceTable{
4304-
OwnerID: u.ID,
4305-
OrganizationID: org.ID,
4306-
TemplateID: tpl.ID,
4307-
})
4308-
pj := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
4309-
res := dbgen.WorkspaceResource(s.T(), db, database.WorkspaceResource{
4310-
JobID: pj.ID,
4311-
})
4312-
agent := dbgen.WorkspaceAgent(s.T(), db, database.WorkspaceAgent{
4313-
ResourceID: res.ID,
4314-
})
4315-
4316-
err := db.UpsertJFrogXrayScanByWorkspaceAndAgentID(context.Background(), database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams{
4317-
AgentID: agent.ID,
4318-
WorkspaceID: ws.ID,
4319-
Critical: 1,
4320-
High: 12,
4321-
Medium: 14,
4322-
ResultsUrl: "http://hello",
4323-
})
4324-
require.NoError(s.T(), err)
4325-
4326-
expect := database.JfrogXrayScan{
4327-
WorkspaceID: ws.ID,
4328-
AgentID: agent.ID,
4329-
Critical: 1,
4330-
High: 12,
4331-
Medium: 14,
4332-
ResultsUrl: "http://hello",
4333-
}
4334-
4335-
check.Args(database.GetJFrogXrayScanByWorkspaceAndAgentIDParams{
4336-
WorkspaceID: ws.ID,
4337-
AgentID: agent.ID,
4338-
}).Asserts(ws, policy.ActionRead).Returns(expect)
4339-
}))
4340-
s.Run("UpsertJFrogXrayScanByWorkspaceAndAgentID", s.Subtest(func(db database.Store, check *expects) {
4341-
u := dbgen.User(s.T(), db, database.User{})
4342-
org := dbgen.Organization(s.T(), db, database.Organization{})
4343-
tpl := dbgen.Template(s.T(), db, database.Template{
4344-
OrganizationID: org.ID,
4345-
CreatedBy: u.ID,
4346-
})
4347-
ws := dbgen.Workspace(s.T(), db, database.WorkspaceTable{
4348-
OwnerID: u.ID,
4349-
OrganizationID: org.ID,
4350-
TemplateID: tpl.ID,
4351-
})
4352-
pj := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
4353-
res := dbgen.WorkspaceResource(s.T(), db, database.WorkspaceResource{
4354-
JobID: pj.ID,
4355-
})
4356-
agent := dbgen.WorkspaceAgent(s.T(), db, database.WorkspaceAgent{
4357-
ResourceID: res.ID,
4358-
})
4359-
check.Args(database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams{
4360-
WorkspaceID: ws.ID,
4361-
AgentID: agent.ID,
4362-
}).Asserts(tpl, policy.ActionCreate)
4363-
}))
43644296
s.Run("DeleteRuntimeConfig", s.Subtest(func(db database.Store, check *expects) {
43654297
check.Args("test").Asserts(rbac.ResourceSystem, policy.ActionDelete)
43664298
}))

0 commit comments

Comments
 (0)