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

make startbuild command external #20382

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Jul 20, 2018

Switches the startbuild command to use external versions.
Switches env utils to use external versions.

Depends on #20399

@deads2k @mfojtik

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 20, 2018
@juanvallejo juanvallejo changed the title Jvallejo/make startbuild external make startbuild command external Jul 20, 2018
@@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mfojtik

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

@@ -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 {
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 versioned / v1 build client does not actually have a BuildResourceInterface

@juanvallejo
Copy link
Contributor Author

cc @soltysh

@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch 2 times, most recently from 3ccb02a to 4f8cfa0 Compare July 23, 2018 18:04

// 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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch from 4f8cfa0 to d938a03 Compare July 23, 2018 18:11
}
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?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch 5 times, most recently from a97ffd0 to 03d0352 Compare July 26, 2018 23:04
@soltysh soltysh self-assigned this Jul 27, 2018
@@ -17,31 +17,31 @@ import (
"time"

"github.com/golang/glog"
"github.com/openshift/origin/pkg/oc/util/ocscheme"
Copy link
Contributor

Choose a reason for hiding this comment

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

Move down to origin

o.BuildArgs = buildArgs

// convert internal buildargs returned from the helper to external versions
externalBuildArgs := []corev1.EnvVar{}
Copy link
Contributor

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.

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 {
Copy link
Contributor

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
}

@@ -0,0 +1,31 @@
package v1
Copy link
Contributor

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.

Copy link
Contributor

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.

@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch from 03d0352 to 6534f83 Compare July 27, 2018 14:06
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 27, 2018
@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch from 6534f83 to 1ee4d08 Compare July 27, 2018 14:14
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 27, 2018
Copy link
Contributor

@soltysh soltysh left a 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.

@@ -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"
Copy link
Contributor

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?

@soltysh
Copy link
Contributor

soltysh commented Jul 27, 2018

/approve

@openshift-ci-robot
Copy link

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2018
@juanvallejo juanvallejo force-pushed the jvallejo/make-startbuild-external branch from 1ee4d08 to f5655a3 Compare July 27, 2018 20:46
@juanvallejo juanvallejo added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2018
@juanvallejo
Copy link
Contributor Author

/test unit

@0xmichalis
Copy link
Contributor

/refresh

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 29, 2018

@juanvallejo: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/cross 6534f83 link /test cross

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.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 757e2a8 into openshift:master Jul 29, 2018
@juanvallejo juanvallejo deleted the jvallejo/make-startbuild-external branch July 30, 2018 13:58
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants