Improve logging
This commit is contained in:
parent
ccc0307bc1
commit
78f801b211
|
|
@ -110,14 +110,15 @@ func (r *ReconcileJenkins) Reconcile(request reconcile.Request) (reconcile.Resul
|
||||||
|
|
||||||
result, err := r.reconcile(request, logger)
|
result, err := r.reconcile(request, logger)
|
||||||
if err != nil && apierrors.IsConflict(err) {
|
if err != nil && apierrors.IsConflict(err) {
|
||||||
logger.V(log.VWarn).Info(err.Error())
|
|
||||||
return reconcile.Result{Requeue: true}, nil
|
return reconcile.Result{Requeue: true}, nil
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
if log.Debug {
|
if log.Debug {
|
||||||
logger.V(log.VWarn).Info(fmt.Sprintf("Reconcile loop failed: %+v", err))
|
logger.V(log.VWarn).Info(fmt.Sprintf("Reconcile loop failed: %+v", err))
|
||||||
} else {
|
} else {
|
||||||
|
if err.Error() != fmt.Sprintf("Operation cannot be fulfilled on jenkins.jenkins.io \"%s\": the object has been modified; please apply your changes to the latest version and try again", request.Name) {
|
||||||
logger.V(log.VWarn).Info(fmt.Sprintf("Reconcile loop failed: %s", err))
|
logger.V(log.VWarn).Info(fmt.Sprintf("Reconcile loop failed: %s", err))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return reconcile.Result{Requeue: true}, nil
|
return reconcile.Result{Requeue: true}, nil
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ func (jobs *Jobs) ensureRunningBuild(build v1alpha1.Build, jenkins *v1alpha1.Jen
|
||||||
|
|
||||||
err = jobs.updateBuildStatus(build, jenkins)
|
err = jobs.updateBuildStatus(build, jenkins)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jobs.logger.V(log.VWarn).Info(fmt.Sprintf("Couldn't update build status, %+v", build))
|
jobs.logger.V(log.VDebug).Info(fmt.Sprintf("Couldn't update build status, %+v", build))
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ func (jobs *Jobs) buildJob(build v1alpha1.Build, parameters map[string]string, j
|
||||||
|
|
||||||
err = jobs.updateBuildStatus(build, jenkins)
|
err = jobs.updateBuildStatus(build, jenkins)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jobs.logger.V(log.VWarn).Info(fmt.Sprintf("Couldn't update build status, %+v", build))
|
jobs.logger.V(log.VDebug).Info(fmt.Sprintf("Couldn't update build status, %+v", build))
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue