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

Allow dash (-) in BuildConfig env vars #20738

Merged
merged 1 commit into from
Aug 23, 2018
Merged

Allow dash (-) in BuildConfig env vars #20738

merged 1 commit into from
Aug 23, 2018

Conversation

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 23, 2018
@coreydaley
Copy link
Member Author

/assign bparees

@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 23, 2018
@coreydaley coreydaley changed the title [WIP] Allow dash (-) in BuildConfig env vars Allow dash (-) in BuildConfig env vars Aug 23, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2018
@coreydaley
Copy link
Member Author

@openshift/sig-developer-experience ptal

@coreydaley
Copy link
Member Author

/retest

@coreydaley coreydaley requested review from adambkaplan and removed request for enj August 23, 2018 13:14
Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

Need to handle case where more than one error is returned by kvalidation

allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ev.Name, cIdentifierErrorMsg))
}
if errs := kvalidation.IsEnvVarName(ev.Name); len(errs) != 0 {
allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ev.Name, strings.Join(errs, "")))
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a delimiter here if multiple errors are returned (semicolon with a space after is my preference).
Since allErrs is a list, you can iterate over the returned errs and add a field.Invalid(...) error for each one, though this may break current conventions.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@@ -59,7 +59,7 @@ func parseIntoEnvVar(spec []string, defaultReader io.Reader, envVarType string)
parts := strings.SplitN(envSpec, "=", 2)
n, v := parts[0], parts[1]
if errs := validation.IsEnvVarName(n); len(errs) != 0 {
return nil, nil, fmt.Errorf("%ss must be of the form key=value, but is %q", envVarType, envSpec)
return nil, nil, fmt.Errorf("%s %s is invalid, %s", envVarType, envSpec, strings.Join(errs, ""))
Copy link
Contributor

Choose a reason for hiding this comment

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

Need delimeter (keep consistency as above).

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@adambkaplan
Copy link
Contributor

/approve

@adambkaplan
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2018
allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ev.Name, cIdentifierErrorMsg))
}
if errs := kvalidation.IsEnvVarName(ev.Name); len(errs) != 0 {
allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ev.Name, strings.Join(errs, "; ")))
Copy link
Contributor

Choose a reason for hiding this comment

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

why not else-if? you're just going to give someone two errors on an empty value now.

Copy link
Member Author

Choose a reason for hiding this comment

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

kvalidation.IsEnvVarName would have to be run a second time to get the error message inside of the else.

Copy link
Contributor

Choose a reason for hiding this comment

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

if len(env.Name) ==0 {
   allErrs= 
} else {
  if errs:=kvalidation.IsEnvVarName(); len(errs)!=0 {
    allErrs= append
  }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

also

	if a:=false; a {
	  fmt.Println(a)
	} else if b:=true; b {
	  fmt.Println(b)
	}
	

is valid syntax.

Copy link
Contributor

Choose a reason for hiding this comment

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

so you don't even have to do what i wrote

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2018
@bparees
Copy link
Contributor

bparees commented Aug 23, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 23, 2018
@bparees
Copy link
Contributor

bparees commented Aug 23, 2018

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan, bparees, coreydaley

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

The pull request process is described here

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

@openshift-merge-robot openshift-merge-robot merged commit 81f26a4 into openshift:master Aug 23, 2018
@spadgett
Copy link
Member

@jhadvig Can you look at updating the regex in console?

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. sig/developer-experience size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants