@@ -695,20 +695,20 @@ func (h *eventHandler) tryEngineCreate(ctx context.Context, spec *job.WorkflowSp
695
695
696
696
// Before running the engine, handle validations
697
697
// Workflow ID should match what is generated from the stored artifacts
698
- owner , err := hex .DecodeString (spec .WorkflowOwner )
698
+ ownerBytes , err := hex .DecodeString (spec .WorkflowOwner )
699
699
if err != nil {
700
700
return fmt .Errorf ("failed to decode owner: %w" , err )
701
701
}
702
- hash , err := pkgworkflows .GenerateWorkflowID (owner , spec .WorkflowName , decodedBinary , []byte (spec .Config ), secretsURL )
702
+ hash , err := pkgworkflows .GenerateWorkflowID (ownerBytes , spec .WorkflowName , decodedBinary , []byte (spec .Config ), secretsURL )
703
703
if err != nil {
704
704
return fmt .Errorf ("failed to generate workflow id: %w" , err )
705
705
}
706
- wfID , err := types .WorkflowIDFromHex (spec .WorkflowID )
706
+ wid , err := types .WorkflowIDFromHex (spec .WorkflowID )
707
707
if err != nil {
708
708
return fmt .Errorf ("invalid workflow id: %w" , err )
709
709
}
710
- if ! types .WorkflowID (hash ).Equal (wfID ) {
711
- return fmt .Errorf ("workflowID mismatch: %x != %x" , hash , wfID )
710
+ if ! types .WorkflowID (hash ).Equal (wid ) {
711
+ return fmt .Errorf ("workflowID mismatch: %x != %x" , hash , wid )
712
712
}
713
713
714
714
// Secrets should be valid
@@ -738,16 +738,6 @@ func (h *eventHandler) tryEngineCreate(ctx context.Context, spec *job.WorkflowSp
738
738
return fmt .Errorf ("failed to start workflow engine: %w" , err )
739
739
}
740
740
741
- ownerBytes , err := hex .DecodeString (spec .WorkflowOwner )
742
- if err != nil {
743
- return err
744
- }
745
-
746
- wid , err := types .WorkflowIDFromHex (spec .WorkflowID )
747
- if err != nil {
748
- return err
749
- }
750
-
751
741
if err := h .engineRegistry .Add (EngineRegistryKey {Owner : ownerBytes , Name : spec .WorkflowName }, engine , wid ); err != nil {
752
742
if closeErr := engine .Close (); closeErr != nil {
753
743
return fmt .Errorf ("failed to close workflow engine: %w during invariant violation: %w" , closeErr , err )
0 commit comments