fix delete pod when runner failed to register
@@ -90,6 +90,7 @@ func (r *RunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
finalizers, removed := removeFinalizer(runner.ObjectMeta.Finalizers)
if removed {
+ if len(runner.Status.Registration.Token) > 0 {
ok, err := r.unregisterRunner(ctx, runner.Spec.Organization, runner.Spec.Repository, runner.Name)
if err != nil {
log.Error(err, "Failed to unregister runner")
@@ -99,6 +100,9 @@ func (r *RunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
if !ok {
log.V(1).Info("Runner no longer exists on GitHub")
}
+ } else {
+ log.V(1).Info("Runner was never registered on GitHub")
+ }
newRunner := runner.DeepCopy()
newRunner.ObjectMeta.Finalizers = finalizers
@@ -108,7 +112,7 @@ func (r *RunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return ctrl.Result{}, err
}
- log.Info("Removed runner from GitHub", "repository", runner.Spec.Repository)
+ log.Info("Removed runner from GitHub", "repository", runner.Spec.Repository, "organization", runner.Spec.Organization)
}
return ctrl.Result{}, nil
