diff --git a/Makefile b/Makefile index 682946b7ec..9fe56ff50b 100644 --- a/Makefile +++ b/Makefile @@ -23,10 +23,13 @@ export GO111MODULE=on $(BIN): @mkdir -p $@ $(BIN)/%: | $(BIN) ; $(info $(M) building $(PACKAGE)…) - $Q tmp=$$(mktemp -d); \ - env GO111MODULE=off GOPATH=$$tmp GOBIN=$(BIN) $(GO) get $(PACKAGE) \ + $Q tmp=$$(mktemp -d); cd $$tmp; \ + env GO111MODULE=on GOPATH=$$tmp GOBIN=$(BIN) $(GO) get $(PACKAGE) \ || ret=$$?; \ - rm -rf $$tmp ; exit $$ret + env GO111MODULE=on GOPATH=$$tmp GOBIN=$(BIN) $(GO) clean -modcache \ + || ret=$$?; \ + cd - ; \ + rm -rf $$tmp ; exit $$ret KO = $(or ${KO_BIN},${KO_BIN},$(BIN)/ko) @@ -35,7 +38,9 @@ TRIGGERS ?= latest DASHBOARD ?= latest RESULTS ?= latest -$(BIN)/ko: PACKAGE=github.com/google/ko/cmd/ko +# TODO: after updating go version to 1.17 uncommnent the line below to install latest version of ko +# $(BIN)/ko: PACKAGE=github.com/google/ko +$(BIN)/ko: PACKAGE=github.com/google/ko@v0.9.3 KUSTOMIZE = $(or ${KUSTOMIZE_BIN},${KUSTOMIZE_BIN},$(BIN)/kustomize) $(BIN)/kustomize: | $(BIN) ; $(info $(M) getting kustomize) diff --git a/pkg/reconciler/openshift/tektonaddon/tektonaddon.go b/pkg/reconciler/openshift/tektonaddon/tektonaddon.go index 1dd277aa81..2f1c301453 100644 --- a/pkg/reconciler/openshift/tektonaddon/tektonaddon.go +++ b/pkg/reconciler/openshift/tektonaddon/tektonaddon.go @@ -200,6 +200,11 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon ta.Status.MarkInstallerSetNotReady(msg) return r.ensureClusterTasks(ctx, ta) } + + if err := r.checkComponentStatus(ctx, clusterTaskLabelSelector); err != nil { + ta.Status.MarkInstallerSetNotReady(err.Error()) + return nil + } } else { // if disabled then delete the installer Set if exist if err := r.deleteInstallerSet(ctx, clusterTaskLabelSelector); err != nil { @@ -207,11 +212,6 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon } } - if err := r.checkComponentStatus(ctx, clusterTaskLabelSelector); err != nil { - ta.Status.MarkInstallerSetNotReady(err.Error()) - return nil - } - // If clusterTasks are enabled then create an InstallerSet // with the versioned clustertask manifest versionedClusterTaskLS := metav1.LabelSelector{ @@ -282,6 +282,11 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon ta.Status.MarkInstallerSetNotReady(msg) return r.ensurePipelineTemplates(ctx, ta) } + + if err := r.checkComponentStatus(ctx, pipelineTemplateLSLabelSelector); err != nil { + ta.Status.MarkInstallerSetNotReady(err.Error()) + return nil + } } else { // if disabled then delete the installer Set if exist if err := r.deleteInstallerSet(ctx, pipelineTemplateLSLabelSelector); err != nil { @@ -289,11 +294,6 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon } } - if err := r.checkComponentStatus(ctx, pipelineTemplateLSLabelSelector); err != nil { - ta.Status.MarkInstallerSetNotReady(err.Error()) - return nil - } - // Ensure Triggers resources triggerResourceLS := metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -353,6 +353,10 @@ func (r *Reconciler) checkComponentStatus(ctx context.Context, labelSelector str return err } + if len(installerSets.Items) == 0 { + return fmt.Errorf("failed to find installerSet using label : %s", labelSelector) + } + ready := installerSets.Items[0].Status.GetCondition(apis.ConditionReady) if ready == nil || ready.Status == corev1.ConditionUnknown { return fmt.Errorf("InstallerSet %s: waiting for installation", installerSets.Items[0].Name)