Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: config injection new config validation #49

Merged
merged 13 commits into from
Jun 23, 2023
Merged

Conversation

gosharo
Copy link
Contributor

@gosharo gosharo commented Jun 20, 2023

Signed-off-by: Gosha [email protected]

Pull Request

Description

Please provide a brief description of the changes made in this pull request.

Related Issue(s)

If this pull request addresses or relates to any open issues, please mention them here using the syntax Fixes #<issue_number> or Resolves #<issue_number>.

Checklist

Before submitting this pull request, please ensure that you have completed the following tasks:

Testing Instructions

Please provide clear instructions on how to test and verify the changes made in this pull request.

Additional Information

Add any additional information or context that would be helpful in understanding and reviewing this pull request.

@gosharo gosharo requested a review from nissim-infra as a code owner June 20, 2023 02:54
@gosharo gosharo requested a review from qadiludmer June 20, 2023 02:56
@gosharo
Copy link
Contributor Author

gosharo commented Jun 20, 2023

Github Enforcer opened Task: RK-18981

@sonariorobot sonariorobot changed the title fix: config injection new config validation RK-18981 - fix: config injection new config validation Jun 20, 2023
@gosharo gosharo changed the title RK-18981 - fix: config injection new config validation fix: config injection new config validation Jun 20, 2023
Copy link
Contributor

@qadiludmer qadiludmer left a comment

Choose a reason for hiding this comment

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

See comments

pkg/workflow-handler/workflows.go Outdated Show resolved Hide resolved
pkg/workflow-handler/workflows.go Outdated Show resolved Hide resolved
@gosharo gosharo force-pushed the config-injection-bugfixes branch from 605456f to 0deec13 Compare June 22, 2023 16:06
@gosharo gosharo requested review from EliRookout and qadiludmer June 22, 2023 16:58
Copy link
Contributor

@qadiludmer qadiludmer left a comment

Choose a reason for hiding this comment

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

See comments

panic("implement me")
func (wfc *WorkflowsClientImpl) SelectConfig(workflowsBatch *common.WorkflowsBatch) (string, error) {
var configName string
ok := IsConfigExists(&wfc.cfg.WorkflowsConfig, "default")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be simplified to:

If config != "" and exists
Use it
Else
Use default

Default will always exists so no need to check for it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

default not always exists..
it there only if configure, if not, it will use the CRDs default values..

Copy link
Contributor

Choose a reason for hiding this comment

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

So what this function returns in case there is no default and no other config ?

Copy link
Contributor

@qadiludmer qadiludmer Jun 23, 2023

Choose a reason for hiding this comment

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

Looks weird that there is a default to the default

Copy link
Contributor

@qadiludmer qadiludmer Jun 23, 2023

Choose a reason for hiding this comment

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

I would not handle config name default as special case here but as regular config that user decided to call it "default" so he needs to explicitly mention he wants to use it

Copy link
Contributor

Choose a reason for hiding this comment

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

It will make the config selection logic more predictable - you get what you asked for if it's existing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the CRD's default is blank, wheres piper default is the DevOps configuration provided

func (wfc *WorkflowsClientImpl) SetConfig(wf *v1alpha1.Workflow, spec *v1alpha1.WorkflowSpec) error {
//TODO implement me
panic("implement me")
func (wfc *WorkflowsClientImpl) SelectConfig(workflowsBatch *common.WorkflowsBatch) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function never returns err so you can get rid of it in the return params.

It always returns just a string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right !

@gosharo gosharo merged commit c84ea9a into main Jun 23, 2023
@gosharo gosharo deleted the config-injection-bugfixes branch July 8, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants