Skip to content

[OpenShift] Add condition check for optional resources - #220

Merged
tekton-robot merged 1 commit into
tektoncd:mainfrom
savitaashture:cond-check-addon
Jan 27, 2021
Merged

[OpenShift] Add condition check for optional resources#220
tekton-robot merged 1 commit into
tektoncd:mainfrom
savitaashture:cond-check-addon

Conversation

@savitaashture

@savitaashture savitaashture commented Jan 26, 2021

Copy link
Copy Markdown
Contributor

Changes

Apply optional addons consoleyamlsamples and consolequickstarts based on CRD existance

/cc @piyush-garg @nikhil-thomas @vdemeester

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

NONE

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jan 26, 2021
@tekton-robot

Copy link
Copy Markdown
Contributor

@savitaashture: GitHub didn't allow me to request PR reviews from the following users: piyush-garg.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

Changes

Apply optional addons consoleyamlsamples and consolequickstarts based on CRD existance

/cc @piyush-garg @nikhil-thomas

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 26, 2021
@tekton-robot

Copy link
Copy Markdown
Contributor

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/common/install.go 65.5% 67.7% 2.2

Comment thread pkg/reconciler/common/install.go Outdated
Comment on lines +243 to +252
CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{})
return err == nil, ignoreNotFound(err)
}

func ignoreNotFound(err error) error {
if errors.IsNotFound(err) {
return nil
}
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we avoid the ignoreNotFound function ..
how about,

...
_, err = apiextensionsclientset.ApiextensionsV1beta1().
		CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{})
        if err == nil {
           	return true, nil
       }
        if !errors.IsNotFound(err) {
           return false, nil
       }
	return false, err
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel instead of adding multiple if conditions calling separate functions will be more clear
WDYT?

@nikhil-thomas

Copy link
Copy Markdown
Member

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 27, 2021
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhil-thomas, piyush-garg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nikhil-thomas

Copy link
Copy Markdown
Member

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants