Skip to content

Commit

Permalink
Merge pull request #61 from stuartwdouglas/double-provision
Browse files Browse the repository at this point in the history
provisioning task could be launched multiple times
  • Loading branch information
stuartwdouglas authored Oct 26, 2023
2 parents 2a75788 + 43d88fe commit a0939c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/reconciler/taskrun/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ func (a DynamicResolver) Allocate(r *ReconcileTaskRun, ctx context.Context, log
if address != "" {
tr.Labels[AssignedHost] = tr.Annotations[CloudInstanceId]
tr.Annotations[CloudAddress] = address

err := launchProvisioningTask(r, ctx, log, tr, secretName, a.SshSecret, address, a.CloudProvider.SshUser())
err := r.client.Update(ctx, tr)
if err != nil {
return reconcile.Result{}, err
}
err = launchProvisioningTask(r, ctx, log, tr, secretName, a.SshSecret, address, a.CloudProvider.SshUser())
if err != nil {
//ugh, try and unassign
err := a.CloudProvider.TerminateInstance(r.client, log, ctx, cloud.InstanceIdentifier(tr.Annotations[CloudInstanceId]))
Expand All @@ -79,7 +82,7 @@ func (a DynamicResolver) Allocate(r *ReconcileTaskRun, ctx context.Context, log
}
}

return reconcile.Result{}, r.client.Update(ctx, tr)
return reconcile.Result{}, nil
} else {
//we are waiting for the instance to come up
//so just requeue
Expand Down

0 comments on commit a0939c6

Please sign in to comment.