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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const DeploymentsList = () => {
header: "Deployment ID",
width: "20%",
headerClassName: "pl-[18px]",
render: ({ deployment, environment }) => {
render: ({ deployment }) => {
const isProduction = deployment.id === activeDeployment.data.at(0)?.id;
const isSelected = deployment.id === selectedDeployment?.deployment.id;
const iconContainer = (
<div
Expand All @@ -85,12 +86,10 @@ export const DeploymentsList = () => {
>
{shortenId(deployment.id)}
</div>
{deployment.id === activeDeployment.data.at(0)?.id ? (
<EnvStatusBadge variant="current" text="Current" />
) : null}
{isProduction ? <EnvStatusBadge variant="current" text="Current" /> : null}
</div>
<div className={cn("font-normal font-mono truncate text-xs mt-1", "text-gray-9")}>
{environment?.slug}
{isProduction ? "Production" : "Preview"}
</div>
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions go/apps/ctrl/services/deployment/create_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func (s *Service) CreateDeployment(
req.Msg.GetProjectId(), req.Msg.GetWorkspaceId()))
}

env, err := db.Query.FindEnvironmentByWorkspaceAndSlug(ctx, s.db.RO(), db.FindEnvironmentByWorkspaceAndSlugParams{
env, err := db.Query.FindEnvironmentByProjectIdAndSlug(ctx, s.db.RO(), db.FindEnvironmentByProjectIdAndSlugParams{
WorkspaceID: req.Msg.GetWorkspaceId(),
ProjectID: project.ID,
Slug: req.Msg.GetEnvironmentSlug(),
})
if err != nil {
Expand Down Expand Up @@ -146,11 +147,12 @@ func (s *Service) CreateDeployment(

// Start the deployment workflow directly
deployReq := &DeployRequest{
WorkspaceID: req.Msg.GetWorkspaceId(),
ProjectID: req.Msg.GetProjectId(),
DeploymentID: deploymentID,
DockerImage: req.Msg.GetDockerImage(),
KeyspaceID: req.Msg.GetKeyspaceId(),
WorkspaceID: req.Msg.GetWorkspaceId(),
ProjectID: req.Msg.GetProjectId(),
EnvironmentID: env.ID,
DeploymentID: deploymentID,
DockerImage: req.Msg.GetDockerImage(),
KeyspaceID: req.Msg.GetKeyspaceId(),
}

executionID, err := s.hydraEngine.StartWorkflow(ctx, "deployment", deployReq,
Expand Down
11 changes: 6 additions & 5 deletions go/apps/ctrl/services/deployment/deploy_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ func (w *DeployWorkflow) Name() string {

// DeployRequest defines the input for the deploy workflow
type DeployRequest struct {
WorkspaceID string `json:"workspace_id"`
ProjectID string `json:"project_id"`
KeyspaceID string `json:"keyspace_id"`
DeploymentID string `json:"deployment_id"`
DockerImage string `json:"docker_image"`
WorkspaceID string `json:"workspace_id"`
ProjectID string `json:"project_id"`
KeyspaceID string `json:"keyspace_id"`
DeploymentID string `json:"deployment_id"`
EnvironmentID string `json:"environment_id"`
DockerImage string `json:"docker_image"`
}

// DeploymentResult holds the deployment outcome
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

8 changes: 5 additions & 3 deletions go/pkg/db/querier_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- name: FindEnvironmentByProjectIdAndSlug :one
SELECT id, workspace_id, project_id, slug, description
FROM environments
WHERE workspace_id = sqlc.arg(workspace_id)
AND project_id = sqlc.arg(project_id)
AND slug = sqlc.arg(slug);

This file was deleted.