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
2 changes: 1 addition & 1 deletion apps/workspace-engine/pkg/oapi/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *System) CompactionKey() (string, string) {
}

func (r *Release) CompactionKey() (string, string) {
return "release", r.ContentHash()
return "release", r.Id.String()
}

func (j *Job) CompactionKey() (string, string) {
Expand Down
2 changes: 1 addition & 1 deletion apps/workspace-engine/pkg/persistence/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ func TestPersistence_ComplexWorkspaceWithComputedValues(t *testing.T) {
require.True(t, ok, "JobAgent should be restored")
assert.Equal(t, "k8s-agent", restoredJobAgent.Name)

restoredRelease, ok := newStore.Repo().Releases().Get(release.ContentHash())
restoredRelease, ok := newStore.Repo().Releases().Get(release.Id.String())
require.True(t, ok, "Release should be restored")
assert.Equal(t, "v1.2.3", restoredRelease.Version.Tag)

Expand Down
6 changes: 3 additions & 3 deletions apps/workspace-engine/pkg/workspace/jobs/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ func (f *Factory) CreateJobForRelease(ctx context.Context, release *oapi.Release

if action != nil {
action.AddStep("Create job", trace.StepResultPass,
fmt.Sprintf("Job created successfully with ID %s for release %s", jobId, release.ContentHash())).
fmt.Sprintf("Job created successfully with ID %s for release %s", jobId, release.Id.String())).
AddMetadata("job_id", jobId).
AddMetadata("job_status", string(oapi.JobStatusPending)).
AddMetadata("job_agent_id", jobAgent.Id).
AddMetadata("release_id", release.ContentHash()).
AddMetadata("release_id", release.Id.String()).
AddMetadata("version_tag", release.Version.Tag)
}

Expand All @@ -184,7 +184,7 @@ func (f *Factory) CreateJobForRelease(ctx context.Context, release *oapi.Release

return &oapi.Job{
Id: jobId,
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
JobAgentId: jobAgent.Id,
JobAgentConfig: jobAgent.Config,
Status: oapi.JobStatusPending,
Expand Down
2 changes: 1 addition & 1 deletion apps/workspace-engine/pkg/workspace/jobs/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestFactory_CreateJobForRelease_SetsCorrectJobFields(t *testing.T) {
require.NoError(t, err)

// Verify release ID is correct
require.Equal(t, release.ContentHash(), job.ReleaseId)
require.Equal(t, release.Id.String(), job.ReleaseId)

// Verify job agent ID is correct
require.Equal(t, jobAgentId, job.JobAgentId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (o *Orchestrator) OnJobStatusChange(
return nil // No release found
}

span.SetAttributes(attribute.String("release.id", release.ContentHash()))
span.SetAttributes(attribute.String("release.id", release.Id.String()), attribute.String("release.content_hash", release.ContentHash()))

policies, err := o.store.ReleaseTargets.GetPolicies(ctx, &release.ReleaseTarget)
if err != nil {
Expand Down Expand Up @@ -97,7 +97,8 @@ func (o *Orchestrator) OnJobStatusChange(
log.Error("Policy action failed",
"action", action.Name(),
"job_id", job.Id,
"release_id", release.ContentHash(),
"release_id", release.Id.String(),
"content_hash", release.ContentHash(),
"error", err)
// Continue with other actions
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestOrchestrator_OnJobStatusChange_TriggerJobSuccess(t *testing.T) {
// Create job
job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand All @@ -172,7 +172,7 @@ func TestOrchestrator_OnJobStatusChange_TriggerJobSuccess(t *testing.T) {
assert.True(t, mockAct.executeCalled)
assert.Equal(t, action.TriggerJobSuccess, mockAct.lastTrigger)
assert.Equal(t, job.Id, mockAct.lastContext.Job.Id)
assert.Equal(t, release.ContentHash(), mockAct.lastContext.Release.ContentHash())
assert.Equal(t, release.Id.String(), mockAct.lastContext.Release.Id.String())
}

func TestOrchestrator_OnJobStatusChange_TriggerJobStarted(t *testing.T) {
Expand All @@ -190,7 +190,7 @@ func TestOrchestrator_OnJobStatusChange_TriggerJobStarted(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusInProgress,
CreatedAt: time.Now(),
}
Expand All @@ -217,7 +217,7 @@ func TestOrchestrator_OnJobStatusChange_TriggerJobFailure(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusFailure,
CreatedAt: time.Now(),
}
Expand All @@ -244,7 +244,7 @@ func TestOrchestrator_OnJobStatusChange_NoTrigger(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusInProgress,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -272,7 +272,7 @@ func TestOrchestrator_OnJobStatusChange_ShouldNotExecute(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestOrchestrator_OnJobStatusChange_MultipleActions(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -357,7 +357,7 @@ func TestOrchestrator_OnJobStatusChange_ActionError(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func (h *RollbackHooks) OnVerificationComplete(ctx context.Context, verification
}

span.SetAttributes(
attribute.String("release.id", release.ContentHash()),
attribute.String("release.id", release.Id.String()),
attribute.String("release.content_hash", release.ContentHash()),
attribute.String("release_target.key", release.ReleaseTarget.Key()),
)

Expand Down Expand Up @@ -106,7 +107,8 @@ func (h *RollbackHooks) OnVerificationComplete(ctx context.Context, verification
}

span.SetAttributes(
attribute.String("rollback_to_release.id", currentRelease.ContentHash()),
attribute.String("rollback_to_release.id", currentRelease.Id.String()),
attribute.String("rollback_to_release.content_hash", currentRelease.ContentHash()),
attribute.String("rollback_to_version.id", currentRelease.Version.Id),
attribute.String("rollback_to_version.tag", currentRelease.Version.Tag),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (r *RollbackAction) Execute(

span.SetAttributes(
attribute.String("trigger", string(trigger)),
attribute.String("release.id", actx.Release.ContentHash()),
attribute.String("release.id", actx.Release.Id.String()),
attribute.String("release.content_hash", actx.Release.ContentHash()),
attribute.String("job.id", actx.Job.Id),
attribute.String("job.status", string(actx.Job.Status)),
)
Expand All @@ -70,7 +71,8 @@ func (r *RollbackAction) Execute(
}

span.SetAttributes(
attribute.String("rollback_to_release.id", currentRelease.ContentHash()),
attribute.String("rollback_to_release.id", currentRelease.Id.String()),
attribute.String("rollback_to_release.content_hash", currentRelease.ContentHash()),
attribute.String("rollback_to_version.id", currentRelease.Version.Id),
attribute.String("rollback_to_version.tag", currentRelease.Version.Tag),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (v *VerificationAction) Execute(

span.SetAttributes(
attribute.String("trigger", string(trigger)),
attribute.String("release.id", actx.Release.ContentHash()),
attribute.String("release.id", actx.Release.Id.String()),
attribute.String("release.content_hash", actx.Release.ContentHash()),
attribute.String("job.id", actx.Job.Id))

// Extract all verification metrics from matching policies
Expand All @@ -62,15 +63,17 @@ func (v *VerificationAction) Execute(
span.SetStatus(codes.Error, "failed to create verification")
log.Error("Failed to create verification",
"error", err,
"release_id", actx.Release.ContentHash(),
"release_id", actx.Release.Id.String(),
"content_hash", actx.Release.ContentHash(),
"job_id", actx.Job.Id,
"trigger", trigger)
return err
}

span.SetStatus(codes.Ok, "verification created")
log.Info("Created verification from policy action",
"release_id", actx.Release.ContentHash(),
"release_id", actx.Release.Id.String(),
"content_hash", actx.Release.ContentHash(),
"job_id", actx.Job.Id,
"trigger", trigger,
"metric_count", len(metrics))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestVerificationAction_Execute_NoMetrics(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestVerificationAction_Execute_CreatesVerification(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func TestVerificationAction_Execute_SkipsWrongTrigger(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -308,7 +308,7 @@ func TestVerificationAction_Execute_DefaultsTriggerToJobSuccess(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -346,7 +346,7 @@ func TestVerificationAction_Execute_DeduplicatesMetrics(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestVerificationAction_Execute_TriggerJobCreated(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusPending,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -447,7 +447,7 @@ func TestVerificationAction_Execute_TriggerJobStarted(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusInProgress,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func TestVerificationAction_Execute_TriggerJobFailure(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusFailure,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -545,7 +545,7 @@ func TestVerificationAction_Execute_PolicyWithMixedRules(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -602,7 +602,7 @@ func TestVerificationAction_Execute_MultipleVerificationRulesInPolicy(t *testing

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -671,7 +671,7 @@ func TestVerificationAction_Execute_NilVerificationRule(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -711,7 +711,7 @@ func TestVerificationAction_Execute_EmptyMetricsArray(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -755,7 +755,7 @@ func TestVerificationAction_Execute_NilPoliciesSlice(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -785,7 +785,7 @@ func TestVerificationAction_Execute_PolicyWithNoRules(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -820,7 +820,7 @@ func TestVerificationAction_Execute_VerificationIsRunningWithCorrectMetricSpecs(

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -887,7 +887,7 @@ func TestVerificationAction_Execute_VerificationRecordHasCorrectReleaseLink(t *t

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down Expand Up @@ -933,7 +933,7 @@ func TestVerificationAction_Execute_MultipleMetricsAllRunning(t *testing.T) {

job := &oapi.Job{
Id: uuid.New().String(),
ReleaseId: release.ContentHash(),
ReleaseId: release.Id.String(),
Status: oapi.JobStatusSuccessful,
CreatedAt: time.Now(),
}
Expand Down
Loading
Loading