Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions .github/workflows/apps-workspace-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,12 @@ jobs:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
run: pnpm exec drizzle-kit migrate

# - name: Run DB package tests
# working-directory: apps/workspace-engine
# env:
# POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
# USE_DATABASE_BACKING: "1"
# SERVICES: "none"
# run: go test -race ./pkg/db/... ./test/e2e/...
- name: Run DB-backed tests
env:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
USE_DATABASE_BACKING: "1"
SERVICES: "none"
run: go test -race ./pkg/db/... ./svc/controllers/...

tests:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,45 +171,3 @@ func (g *PostgresGetter) GetPolicySkips(
}
return result, nil
}

func (g *PostgresGetter) GetCurrentRelease(
ctx context.Context,
rt *ReleaseTarget,
) (*oapi.Release, error) {
q := db.GetQueries(ctx)

releases, err := q.ListReleasesByReleaseTarget(ctx, db.ListReleasesByReleaseTargetParams{
ResourceID: rt.ResourceID,
EnvironmentID: rt.EnvironmentID,
DeploymentID: rt.DeploymentID,
})
if err != nil {
return nil, fmt.Errorf("list releases for release target: %w", err)
}
if len(releases) == 0 {
return nil, nil
}

latest := releases[0]
versionRow, err := q.GetDeploymentVersionByID(ctx, latest.VersionID)
if err != nil {
return nil, fmt.Errorf("get version %s: %w", latest.VersionID, err)
}

createdAt := ""
if latest.CreatedAt.Valid {
createdAt = latest.CreatedAt.Time.Format("2006-01-02T15:04:05Z07:00")
}

return &oapi.Release{
ReleaseTarget: oapi.ReleaseTarget{
DeploymentId: rt.DeploymentID.String(),
EnvironmentId: rt.EnvironmentID.String(),
ResourceId: rt.ResourceID.String(),
},
Version: *db.ToOapiDeploymentVersion(versionRow),
Variables: map[string]oapi.LiteralValue{},
EncryptedVariables: []string{},
CreatedAt: createdAt,
}, nil
}
Loading
Loading