diff --git a/pkg/controller/jenkins/configuration/user/reconcile.go b/pkg/controller/jenkins/configuration/user/reconcile.go index cd688c93f..b7155474f 100644 --- a/pkg/controller/jenkins/configuration/user/reconcile.go +++ b/pkg/controller/jenkins/configuration/user/reconcile.go @@ -78,27 +78,26 @@ func (r *ReconcileUserConfiguration) ensureSeedJobs() (reconcile.Result, error) } func (r *ReconcileUserConfiguration) ensureUserConfiguration(jenkinsClient jenkinsclient.Jenkins) (reconcile.Result, error) { - groovyClient := groovy.New(jenkinsClient, r.Client, r.logger, r.Configuration.Jenkins, "user-groovy", r.Configuration.Jenkins.Spec.GroovyScripts.Customization) - - requeue, err := groovyClient.WaitForSecretSynchronization(resources.GroovyScriptsSecretVolumePath) + configurationAsCodeClient := casc.New(jenkinsClient, r.Client, r.logger, r.Configuration.Jenkins) + requeue, err := configurationAsCodeClient.Ensure(r.Configuration.Jenkins) if err != nil { return reconcile.Result{}, err } if requeue { return reconcile.Result{Requeue: true}, nil } - requeue, err = groovyClient.Ensure(func(name string) bool { - return strings.HasSuffix(name, ".groovy") - }, groovy.AddSecretsLoaderToGroovyScript(resources.GroovyScriptsSecretVolumePath)) + + groovyClient := groovy.New(jenkinsClient, r.Client, r.logger, r.Configuration.Jenkins, "user-groovy", r.Configuration.Jenkins.Spec.GroovyScripts.Customization) + requeue, err = groovyClient.WaitForSecretSynchronization(resources.GroovyScriptsSecretVolumePath) if err != nil { return reconcile.Result{}, err } if requeue { return reconcile.Result{Requeue: true}, nil } - - configurationAsCodeClient := casc.New(jenkinsClient, r.Client, r.logger, r.Configuration.Jenkins) - requeue, err = configurationAsCodeClient.Ensure(r.Configuration.Jenkins) + requeue, err = groovyClient.Ensure(func(name string) bool { + return strings.HasSuffix(name, ".groovy") + }, groovy.AddSecretsLoaderToGroovyScript(resources.GroovyScriptsSecretVolumePath)) if err != nil { return reconcile.Result{}, err }