-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
make startbuild command external #20382
make startbuild command external #20382
Conversation
pkg/pod/envresolve/env.go
Outdated
@@ -71,6 +72,7 @@ func getResourceFieldRef(from *kapi.EnvVarSource, c *kapi.Container) (string, er | |||
} | |||
|
|||
// GenEnvVarRefValue returns the value referenced by the supplied EnvVarSource given the other supplied information | |||
// TODO: how to handle this? It is also used by the build controller which deals with internal versions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The set/env command needs this helper to receive a corev1.EnvVarSource and a corev1.Container.
The build controller depends on a separate helper in pkg/build/controller/common which depends on the current (internal) signature of this helper
pkg/oc/cli/startbuild/startbuild.go
Outdated
@@ -890,7 +888,7 @@ func gitRefInfo(repo git.Repository, dir, ref string) (buildapi.GitRefInfo, erro | |||
} | |||
|
|||
// WaitForBuildComplete waits for a build identified by the name to complete | |||
func WaitForBuildComplete(c buildclient.BuildResourceInterface, name string) error { | |||
func WaitForBuildComplete(c buildclientv1.BuildResourceInterface, name string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the versioned / v1 build client does not actually have a BuildResourceInterface
cc @soltysh |
3ccb02a
to
4f8cfa0
Compare
pkg/oc/cli/startbuild/startbuild.go
Outdated
|
||
// Handle environment variables | ||
cmdutil.WarnAboutCommaSeparation(o.ErrOut, o.Env, "--env") | ||
// TODO: not sure what to do here, duplicate this helper to return v1 EnvVars? | ||
env, _, err := utilenv.ParseEnv(o.Env, o.In) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do in-place conversion using kcmdutil.AsDefaultVersionedOrOriginal
for now and leave there a TODO. In a followup to this and #20400 you'll sweep those at once.
4f8cfa0
to
d938a03
Compare
pkg/oc/cli/startbuild/startbuild.go
Outdated
} | ||
o.EnvVar = env | ||
|
||
// Handle Docker build arguments. In order to leverage existing logic, we | ||
// first create an EnvVar array, then convert it to []docker.BuildArg | ||
// TODO: also not sure what to do here, duplicate this helper to return v1 EnvVars? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a97ffd0
to
03d0352
Compare
pkg/oc/cli/startbuild/startbuild.go
Outdated
@@ -17,31 +17,31 @@ import ( | |||
"time" | |||
|
|||
"github.com/golang/glog" | |||
"github.com/openshift/origin/pkg/oc/util/ocscheme" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move down to origin
pkg/oc/cli/startbuild/startbuild.go
Outdated
o.BuildArgs = buildArgs | ||
|
||
// convert internal buildargs returned from the helper to external versions | ||
externalBuildArgs := []corev1.EnvVar{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a helper and use here and couple lines above.
pkg/oc/cli/startbuild/startbuild.go
Outdated
if err = json.Unmarshal(body, &buildapiv1.Build{}); err == nil { | ||
if err = runtime.DecodeInto(legacyscheme.Codecs.UniversalDecoder(), body, &newBuild); err != nil { | ||
newBuild := &buildv1.Build{} | ||
if err = json.Unmarshal(body, newBuild); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks overly complicated, why not doing:
newBuild := &buildv1.Build{}
if err := json.Unmarshal(body, newBuild); err != nil {
return err
}
if err := o.Printer.PrintObj(newBuild, o.Out); err != nil {
return err
}
pkg/build/client/v1/logs.go
Outdated
@@ -0,0 +1,31 @@ | |||
package v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shims? From my comparison it looks like only the parameter differs, so in-place conversions to internals and use that, at least for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't satisfy a complexity requirement. A duplicate here is ok.
03d0352
to
6534f83
Compare
6534f83
to
1ee4d08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, feel free to self-lgtm when you fix it.
pkg/oc/cli/startbuild/startbuild.go
Outdated
@@ -22,26 +22,27 @@ import ( | |||
"github.com/openshift/source-to-image/pkg/tar" | |||
s2ifs "github.com/openshift/source-to-image/pkg/util/fs" | |||
|
|||
"github.com/openshift/origin/pkg/oc/util/ocscheme" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move down to origin's imports, besides that scheme should be from k8s, right?
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: juanvallejo, soltysh 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 |
1ee4d08
to
f5655a3
Compare
/test unit |
/refresh |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@juanvallejo: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Switches the startbuild command to use external versions.
Switches env utils to use external versions.
Depends on #20399@deads2k @mfojtik