Skip to content
Open
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
339 changes: 331 additions & 8 deletions api/build/build_v1alpha/rpc.gen.go

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions api/build/rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ imports:
stream:
path: ../../pkg/rpc/stream/stream.yml
import: miren.dev/runtime/pkg/rpc/stream
standard:
path: ../../pkg/rpc/standard/standard.yml
import: miren.dev/runtime/pkg/rpc/standard

types:
- type: Status
Expand All @@ -27,6 +30,86 @@ types:
- name: log
type: LogEntry
index: 4
- name: deployment
type: DeploymentProgress
index: 5

- type: DeploymentProgress
doc: >
Progress of the server-managed deployment record backing this build. Sent
once the record exists, and again on each phase change, so the client can
display and cancel a deployment it did not create.
fields:
- name: deployment_id
type: string
index: 0
doc: The deployment record the server created for this build
- name: phase
type: string
index: 1
doc: Current phase (preparing, building, pushing, activating)

- type: DeployRequest
doc: >
Asks the server to own the deployment record for this build: create it,
advance it as the build progresses, and settle it at the end.

Its PRESENCE is the ownership signal. When absent — which is what an older
client sends, since it does not know this parameter — the server does not
touch deployment records at all and the client is left to drive them
through the deployment service as before. That is what stops a build from
producing two records for one deploy.
fields:
- name: cluster_id
type: string
index: 0
doc: >
The cluster being deployed to. Client-side configuration the server
cannot infer, so it has to be passed.
- name: git_info
type: GitInfo
index: 1
doc: Git state of the working tree being deployed (optional)

- type: GitInfo
doc: Git repository information recorded on the deployment
fields:
- name: sha
type: string
index: 0
doc: Git commit SHA
- name: branch
type: string
index: 1
doc: Git branch name
- name: repository
type: string
index: 2
doc: Git repository URL
- name: is_dirty
type: bool
index: 3
doc: Whether working tree had uncommitted changes
- name: working_tree_hash
type: string
index: 4
doc: Hash of working tree if dirty
- name: commit_message
type: string
index: 5
doc: Git commit message
- name: commit_author_name
type: string
index: 6
doc: Name of commit author
- name: commit_author_email
type: string
index: 7
doc: Email of commit author
- name: commit_timestamp
type: standard.Timestamp
index: 8
doc: When the commit was made

- type: LogEntry
doc: A structured log message with severity level and extensible fields
Expand Down Expand Up @@ -221,6 +304,11 @@ interfaces:
- name: ephemeral_ttl
type: string
doc: TTL for ephemeral version (e.g., "48h"), defaults to "24h" when ephemeral_label is set
- name: deployment
type: '*DeployRequest'
doc: >
When set, the server owns the deployment record for this build.
When absent, it creates none — see DeployRequest.
results:
- name: version
type: string
Expand Down Expand Up @@ -268,6 +356,11 @@ interfaces:
- name: ephemeral_ttl
type: string
doc: TTL for ephemeral version (e.g., "48h"), defaults to "24h" when ephemeral_label is set
- name: deployment
type: '*DeployRequest'
doc: >
When set, the server owns the deployment record for this build.
When absent, it creates none — see DeployRequest.
results:
- name: version
type: string
Expand Down
109 changes: 99 additions & 10 deletions api/core/core_v1alpha/schema.gen.go

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions api/core/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,30 @@ kinds:
type: string
doc: Git repository remote URL

deployment_lock:
app_name:
type: string
doc: >
The app this lock covers. The lock is app-scoped, not app+cluster: a
coordinator's store only holds its own cluster's deployments, and the
client-supplied cluster_id is unreliable (see MIR-1465).
indexed: true

deployment_id:
type: string
doc: The deployment currently holding the lock

acquired_at:
type: time
doc: When the lock was taken

expires_at:
type: time
doc: >
When the lock may be stolen by another deployment. A holder whose
deployment reached a terminal status is stealable before this too.
indexed: true

config_version:
app:
type: ref
Expand Down
162 changes: 162 additions & 0 deletions api/deployment/deployment_v1alpha/rpc.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,88 @@ func (v *DeploymentSetEnvVarsResults) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &v.data)
}

type deploymentGetDeployLockArgsData struct {
AppName *string `cbor:"0,keyasint,omitempty" json:"app_name,omitempty"`
ClusterId *string `cbor:"1,keyasint,omitempty" json:"cluster_id,omitempty"`
}

type DeploymentGetDeployLockArgs struct {
call rpc.Call
data deploymentGetDeployLockArgsData
}

func (v *DeploymentGetDeployLockArgs) HasAppName() bool {
return v.data.AppName != nil
}

func (v *DeploymentGetDeployLockArgs) AppName() string {
if v.data.AppName == nil {
return ""
}
return *v.data.AppName
}

func (v *DeploymentGetDeployLockArgs) HasClusterId() bool {
return v.data.ClusterId != nil
}

func (v *DeploymentGetDeployLockArgs) ClusterId() string {
if v.data.ClusterId == nil {
return ""
}
return *v.data.ClusterId
}

func (v *DeploymentGetDeployLockArgs) MarshalCBOR() ([]byte, error) {
return cbor.Marshal(v.data)
}

func (v *DeploymentGetDeployLockArgs) UnmarshalCBOR(data []byte) error {
return cbor.Unmarshal(data, &v.data)
}

func (v *DeploymentGetDeployLockArgs) MarshalJSON() ([]byte, error) {
return json.Marshal(v.data)
}

func (v *DeploymentGetDeployLockArgs) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &v.data)
}

type deploymentGetDeployLockResultsData struct {
Held *bool `cbor:"0,keyasint,omitempty" json:"held,omitempty"`
LockInfo *DeploymentLockInfo `cbor:"1,keyasint,omitempty" json:"lock_info,omitempty"`
}

type DeploymentGetDeployLockResults struct {
call rpc.Call
data deploymentGetDeployLockResultsData
}

func (v *DeploymentGetDeployLockResults) SetHeld(held bool) {
v.data.Held = &held
}

func (v *DeploymentGetDeployLockResults) SetLockInfo(lock_info *DeploymentLockInfo) {
v.data.LockInfo = lock_info
}

func (v *DeploymentGetDeployLockResults) MarshalCBOR() ([]byte, error) {
return cbor.Marshal(v.data)
}

func (v *DeploymentGetDeployLockResults) UnmarshalCBOR(data []byte) error {
return cbor.Unmarshal(data, &v.data)
}

func (v *DeploymentGetDeployLockResults) MarshalJSON() ([]byte, error) {
return json.Marshal(v.data)
}

func (v *DeploymentGetDeployLockResults) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &v.data)
}

type deploymentDeleteEnvVarsArgsData struct {
AppName *string `cbor:"0,keyasint,omitempty" json:"app_name,omitempty"`
ClusterId *string `cbor:"1,keyasint,omitempty" json:"cluster_id,omitempty"`
Expand Down Expand Up @@ -2211,6 +2293,32 @@ func (t *DeploymentSetEnvVars) Results() *DeploymentSetEnvVarsResults {
return results
}

type DeploymentGetDeployLock struct {
rpc.Call
args DeploymentGetDeployLockArgs
results DeploymentGetDeployLockResults
}

func (t *DeploymentGetDeployLock) Args() *DeploymentGetDeployLockArgs {
args := &t.args
if args.call != nil {
return args
}
args.call = t.Call
t.Call.Args(args)
return args
}

func (t *DeploymentGetDeployLock) Results() *DeploymentGetDeployLockResults {
results := &t.results
if results.call != nil {
return results
}
results.call = t.Call
t.Call.Results(results)
return results
}

type DeploymentDeleteEnvVars struct {
rpc.Call
args DeploymentDeleteEnvVarsArgs
Expand Down Expand Up @@ -2249,6 +2357,7 @@ type Deployment interface {
CancelDeployment(ctx context.Context, state *DeploymentCancelDeployment) error
DeployVersion(ctx context.Context, state *DeploymentDeployVersion) error
SetEnvVars(ctx context.Context, state *DeploymentSetEnvVars) error
GetDeployLock(ctx context.Context, state *DeploymentGetDeployLock) error
DeleteEnvVars(ctx context.Context, state *DeploymentDeleteEnvVars) error
}

Expand Down Expand Up @@ -2300,6 +2409,10 @@ func (reexportDeployment) SetEnvVars(ctx context.Context, state *DeploymentSetEn
panic("not implemented")
}

func (reexportDeployment) GetDeployLock(ctx context.Context, state *DeploymentGetDeployLock) error {
panic("not implemented")
}

func (reexportDeployment) DeleteEnvVars(ctx context.Context, state *DeploymentDeleteEnvVars) error {
panic("not implemented")
}
Expand Down Expand Up @@ -2420,6 +2533,16 @@ func AdaptDeployment(t Deployment) *rpc.Interface {
return t.SetEnvVars(ctx, &DeploymentSetEnvVars{Call: call})
},
},
{
Name: "GetDeployLock",
InterfaceName: "Deployment",
Index: 12,
Public: false,
Params: []string{"app_name", "cluster_id"},
Handler: func(ctx context.Context, call rpc.Call) error {
return t.GetDeployLock(ctx, &DeploymentGetDeployLock{Call: call})
},
},
{
Name: "DeleteEnvVars",
InterfaceName: "Deployment",
Expand Down Expand Up @@ -2874,6 +2997,45 @@ func (v DeploymentClient) SetEnvVars(ctx context.Context, app_name string, clust
return &DeploymentClientSetEnvVarsResults{client: v.Client, data: ret}, nil
}

type DeploymentClientGetDeployLockResults struct {
client rpc.Client
data deploymentGetDeployLockResultsData
}

func (v *DeploymentClientGetDeployLockResults) HasHeld() bool {
return v.data.Held != nil
}

func (v *DeploymentClientGetDeployLockResults) Held() bool {
if v.data.Held == nil {
return false
}
return *v.data.Held
}

func (v *DeploymentClientGetDeployLockResults) HasLockInfo() bool {
return v.data.LockInfo != nil
}

func (v *DeploymentClientGetDeployLockResults) LockInfo() *DeploymentLockInfo {
return v.data.LockInfo
}

func (v DeploymentClient) GetDeployLock(ctx context.Context, app_name string, cluster_id string) (*DeploymentClientGetDeployLockResults, error) {
args := DeploymentGetDeployLockArgs{}
args.data.AppName = &app_name
args.data.ClusterId = &cluster_id

var ret deploymentGetDeployLockResultsData

err := v.Call(ctx, "GetDeployLock", &args, &ret)
if err != nil {
return nil, err
}

return &DeploymentClientGetDeployLockResults{client: v.Client, data: ret}, nil
}

type DeploymentClientDeleteEnvVarsResults struct {
client rpc.Client
data deploymentDeleteEnvVarsResultsData
Expand Down
Loading
Loading