Repository: tektoncd/operator
Pull request #645 (2022-03-02 11:04:56)

Improves error handling in TektonHub and reorder the job in TektonInstallerSet
# Changes

<!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 -->

<!-- Describe your changes here- ideally you can get that description straight from
your descriptive commit message(s)! -->

# Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

- [ ] Includes [tests](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if functionality changed/added)
- [ ] Includes [docs](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if user facing)
- [x] Commit messages follow [commit message best practices](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages)

_See [the contribution guide](https://github.com/tektoncd/operator/blob/master/CONTRIBUTING.md) for more details._

# Release Notes

<!--
Describe any user facing changes here, or delete this block.

Examples of user facing changes:
- API changes
- Bug fixes
- Any changes in behavior
- Changes requiring upgrade notices or deprecation warnings

For pull requests with a release note:

```release-note
Your release note here
```

For pull requests that require additional action from users switching to the new release, include the string "action required" (case insensitive) in the release note:

```release-note
action required: your release note here
```

For pull requests that don't need to be mentioned at release time, use the `/release-note-none` Prow command to add the `release-note-none` label to the PR. You can also write the string "NONE" as a release note in your PR description:

```release-note
NONE
```
-->


tekton-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **houshengbo**
You can assign the PR to them by writing `/assign @houshengbo` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=tektoncd%2Foperator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/tektoncd/operator/blob/main/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["houshengbo"]} -->
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/apis/operator/v1alpha1/tektonhub_defaults.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file1) | Do not exist | 83.3% | 
[pkg/apis/operator/v1alpha1/tektonhub_lifecycle.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file2) | Do not exist | 39.1% | 
[pkg/apis/operator/v1alpha1/tektonhub_types.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file3) | 100.0% | 33.3% | -66.7
[pkg/apis/operator/v1alpha1/tektonhub_validation.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file4) | 100.0% | 96.2% | -3.8
[pkg/reconciler/common/releases.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file6) | 41.9% | 41.3% | -0.7
[pkg/reconciler/kubernetes/tektoninstallerset/install.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1498977772641456131/artifacts/line-cov.html#file7) | 76.3% | 77.2% | 0.9

tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/kubernetes/tektoninstallerset/install.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1499241259082977280/artifacts/line-cov.html#file0) | 77.2% | 77.6% | 0.3

tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499241259082977283/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499241259082977283/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
PuneetPunamiya: /test pull-tekton-operator-integration-tests
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499244781757272064/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499244781757272064/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
PuneetPunamiya: /test pull-tekton-operator-integration-tests
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499249815920316416/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499249815920316416/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
nikhil-thomas: /lgtm
nikhil-thomas: /retest
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499298385537011712/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499298385537011712/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
PuneetPunamiya: /test pull-tekton-operator-integration-tests

tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499300147425710080/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499300147425710080/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
PuneetPunamiya: /retest
tekton-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/tektoncd/operator/pull/645#pullrequestreview-898626404" title="Approved">vdemeester</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=tektoncd%2Foperator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/tektoncd/operator/blob/main/OWNERS)~~ [vdemeester]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499313736656097281/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-integration-tests | d5ca47e2a84d85c3e24a6a19c88feda039091ad0 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-integration-tests/1499313736656097281/) | `/test pull-tekton-operator-integration-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/645). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: New changes are detected. LGTM label has been removed.
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/kubernetes/tektoninstallerset/install.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/645/pull-tekton-operator-go-coverage/1499322293313081344/artifacts/line-cov.html#file0) | 77.2% | 77.6% | 0.3

vdemeester: /lgtm

Patch:
diff --git a/pkg/reconciler/kubernetes/tektonhub/tektonhub.go b/pkg/reconciler/kubernetes/tektonhub/tektonhub.go
index c6875fb35..4970b39e9 100644
--- a/pkg/reconciler/kubernetes/tektonhub/tektonhub.go
+++ b/pkg/reconciler/kubernetes/tektonhub/tektonhub.go
@@ -139,19 +139,19 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, th *v1alpha1.TektonHub)
 
 	// Manage DB
 	if err := r.manageDbComponent(ctx, th, hubDir, version); err != nil {
-		return err
+		return r.handleError(err, th)
 	}
 	th.Status.MarkDbInstallerSetAvailable()
 
 	// Manage DB migration
 	if err := r.manageDbMigrationComponent(ctx, th, hubDir, version); err != nil {
-		return err
+		return r.handleError(err, th)
 	}
 	th.Status.MarkDatabasebMigrationDone()
 
 	// Manage API
 	if err := r.manageApiComponent(ctx, th, hubDir, version); err != nil {
-		return err
+		return r.handleError(err, th)
 	}
 	th.Status.MarkApiInstallerSetAvailable()
 
@@ -164,6 +164,14 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, th *v1alpha1.TektonHub)
 	return nil
 }
 
+func (r *Reconciler) handleError(err error, th *v1alpha1.TektonHub) error {
+	if err == v1alpha1.RECONCILE_AGAIN_ERR {
+		r.enqueueAfter(th, 10*time.Second)
+		return nil
+	}
+	return err
+}
+
 func (r *Reconciler) manageApiComponent(ctx context.Context, th *v1alpha1.TektonHub, hubDir, version string) error {
 	// Validate whether the secrets and configmap are created for API
 	if err := r.validateApiDependencies(ctx, th); err != nil {
@@ -191,8 +199,7 @@ func (r *Reconciler) manageApiComponent(ctx context.Context, th *v1alpha1.Tekton
 	err = r.checkComponentStatus(ctx, th, apiInstallerSet)
 	if err != nil {
 		th.Status.MarkApiInstallerSetNotAvailable(err.Error())
-		r.enqueueAfter(th, 10*time.Second)
-		return err
+		return v1alpha1.RECONCILE_AGAIN_ERR
 	}
 	return nil
 }
@@ -216,8 +223,7 @@ func (r *Reconciler) manageDbMigrationComponent(ctx context.Context, th *v1alpha
 	err = r.checkComponentStatus(ctx, th, dbMigrationInstallerSet)
 	if err != nil {
 		th.Status.MarkDatabasebMigrationFailed(err.Error())
-		r.enqueueAfter(th, 10*time.Second)
-		return err
+		return v1alpha1.RECONCILE_AGAIN_ERR
 	}
 	return nil
 }
@@ -247,8 +253,7 @@ func (r *Reconciler) manageDbComponent(ctx context.Context, th *v1alpha1.TektonH
 	err = r.checkComponentStatus(ctx, th, dbInstallerSet)
 	if err != nil {
 		th.Status.MarkDbInstallerSetNotAvailable(err.Error())
-		r.enqueueAfter(th, 10*time.Second)
-		return err
+		return v1alpha1.RECONCILE_AGAIN_ERR
 	}
 
 	return nil
diff --git a/pkg/reconciler/kubernetes/tektoninstallerset/install.go b/pkg/reconciler/kubernetes/tektoninstallerset/install.go
index 35e08067c..d812794b9 100644
--- a/pkg/reconciler/kubernetes/tektoninstallerset/install.go
+++ b/pkg/reconciler/kubernetes/tektoninstallerset/install.go
@@ -17,6 +17,7 @@ limitations under the License.
 package tektoninstallerset
 
 import (
+	"context"
 	"fmt"
 	"strings"
 
@@ -30,6 +31,7 @@ import (
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/client-go/kubernetes/scheme"
+	"knative.dev/pkg/logging"
 	"knative.dev/pkg/ptr"
 )
 
@@ -354,7 +356,7 @@ func (i *installer) AllDeploymentsReady() error {
 	return nil
 }
 
-func (i *installer) IsJobCompleted() error {
+func (i *installer) IsJobCompleted(ctx context.Context, labels map[string]string, installSetName string) error {
 	for _, u := range i.Manifest.Filter(jobPred).Resources() {
 		resource, err := i.Manifest.Client.Get(&u)
 		if err != nil {
@@ -364,7 +366,10 @@ func (i *installer) IsJobCompleted() error {
 		if err := scheme.Scheme.Convert(resource, job, nil); err != nil {
 			return err
 		}
+
+		logger := logging.FromContext(ctx)
 		if !isJobCompleted(job) {
+			logger.Info("job not ready in installerset, name: %s, created-by: %s, in namespace: %s", installSetName, labels[v1alpha1.CreatedByKey], job.GetNamespace())
 			return fmt.Errorf("Job not successful")
 		}
 	}
diff --git a/pkg/reconciler/kubernetes/tektoninstallerset/tektoninstallerset.go b/pkg/reconciler/kubernetes/tektoninstallerset/tektoninstallerset.go
index 0268f4533..9ac793566 100644
--- a/pkg/reconciler/kubernetes/tektoninstallerset/tektoninstallerset.go
+++ b/pkg/reconciler/kubernetes/tektoninstallerset/tektoninstallerset.go
@@ -166,6 +166,14 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, installerSet *v1alpha1.T
 	// Update Ready status of Controller
 	installerSet.Status.MarkControllerReady()
 
+	// job
+	labels := installerSet.GetLabels()
+	installSetname := installerSet.GetName()
+	err = installer.IsJobCompleted(ctx, labels, installSetname)
+	if err != nil {
+		return err
+	}
+
 	// Check if any other deployment exists other than controller
 	// and webhook and is ready
 	err = installer.AllDeploymentsReady()
@@ -178,12 +186,6 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, installerSet *v1alpha1.T
 	// Mark all deployments ready
 	installerSet.Status.MarkAllDeploymentsReady()
 
-	// job
-	err = installer.IsJobCompleted()
-	if err != nil {
-		return err
-	}
-
 	return nil
 }
 


Test patch:
diff --git a/pkg/reconciler/kubernetes/tektoninstallerset/install_test.go b/pkg/reconciler/kubernetes/tektoninstallerset/install_test.go
index 4336b5ba0..84e8cde5e 100644
--- a/pkg/reconciler/kubernetes/tektoninstallerset/install_test.go
+++ b/pkg/reconciler/kubernetes/tektoninstallerset/install_test.go
@@ -17,6 +17,7 @@ limitations under the License.
 package tektoninstallerset
 
 import (
+	"context"
 	"fmt"
 	"testing"
 
@@ -416,7 +417,7 @@ func TestJobCompleted(t *testing.T) {
 		Manifest: manifest,
 	}
 
-	err = i.IsJobCompleted()
+	err = i.IsJobCompleted(context.Background(), nil, "")
 	if err != nil {
 		t.Fatal("Unexpected Error: ", err)
 	}
@@ -435,7 +436,7 @@ func TestJobFailed(t *testing.T) {
 		Manifest: manifest,
 	}
 
-	err = i.IsJobCompleted()
+	err = i.IsJobCompleted(context.Background(), nil, "")
 	if err == nil {
 		t.Fatal("Expected Error but got nil ")
 	}