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

Request -> Config refactor + additional cleanups. #204

Merged
merged 1 commit into from
May 29, 2015

Conversation

soltysh
Copy link
Member

@soltysh soltysh commented May 27, 2015

I've added method for validating Config object - should fix #144. I've also reviewed and removed unnecessary fields from Config, which was also renamed from Request (fixed #100).

@bparees @mfojtik @csrwng PTAL, that's the last refactor I'd like to make before updating the origin's version. Maybe we could name it 1.0 release? Any thoughts one that are welcome as well.

// InstallDestination allows to override the default destination of the STI
// scripts. It allows to place the scripts into application root directory
// (see ONBUILD strategy). The default value is "upload/scripts".
InstallDestination string
Copy link
Contributor

Choose a reason for hiding this comment

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

pkg/build/strategies/sti/sti.go
71: inst := script.NewInstaller(req.BaseImage, req.ScriptsURL, req.InstallDestination, docker)

This was originally used here, for some reason it is not anymore. Is there a reason why?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not being used anymore from what I looked into. And the problem this variable was trying to address is solved differently from what I tested. Currently this function copies STI scripts to main app dir which works nicely. If there are other usecases that this was addressing we don't have them written down in any reproducable way (eg. integration tests). That's why I've also opened #203 to track these.

@mfojtik
Copy link
Contributor

mfojtik commented May 28, 2015

@soltysh few nits but I really like this refactoring. Good job!

@soltysh
Copy link
Member Author

soltysh commented May 28, 2015

@mfojtik answered all of your questions/doubts, fixed one. @csrwng can I have your LGTM on it as well. I'd like to have it merged today to update it in origin later.

}
}

if !validRequest(req) {
if len(validation.ValidateConfig(cfg)) != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be ideal if we moved some of this logic to a function in a different package (anything that doesn't have to do with the environment or command line args) so we can reuse it from origin. Otherwise we'd have to repeat the same code in origin (validating the config, creating the build strategy, etc)

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the initial goal, to have validation method available to be run in origin (see #144). But I agree we can revisit this method once again to do that. I've created an issue to track that #206. If you don't mind, I'll do that as a follow-up. I don't want to get this PR more hairy than it's already is 😉

@csrwng
Copy link
Contributor

csrwng commented May 29, 2015

Apart from comments above, LGTM

@soltysh
Copy link
Member Author

soltysh commented May 29, 2015

@csrwng since that last comment was on commit and it's lost, I've added additional validation for DockerConfig.Endpoint, as this what we use in origin, at least now and it makes sense to have required.

Reviewed and removed unnecessary fields from Config, which was also
renamed from Request (fixed openshift#100).
@mfojtik
Copy link
Contributor

mfojtik commented May 29, 2015

LGTM

@soltysh
Copy link
Member Author

soltysh commented May 29, 2015

[merge]

@openshift-bot
Copy link
Contributor

Source To Image Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_sti/109/)

@openshift-bot
Copy link
Contributor

Evaluated for source to image up to ad4dd9e

openshift-bot pushed a commit that referenced this pull request May 29, 2015
@openshift-bot openshift-bot merged commit bd57baf into openshift:master May 29, 2015
@soltysh soltysh deleted the issue144 branch May 29, 2015 11:38
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.

Add better mechanism for api.Request validation Hide private Request fields
4 participants