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

oc start-build --from-repo now uses clone+checkout #10316

Merged
merged 1 commit into from
Nov 5, 2016
Merged

oc start-build --from-repo now uses clone+checkout #10316

merged 1 commit into from
Nov 5, 2016

Conversation

oatmealraisin
Copy link

This allows us to handle submodules. However, it takes up a bit more
resources. This shouldn't be a problem - even the Linux kernel only
took about 3 seconds to clone to another local directory.

Fixes #8922
@bparees @sosiouxme ptal?

@oatmealraisin
Copy link
Author

[test]

Recursive: true,
Shallow: false,
// TODO: Should we output this at a loglevel? If so, what level?
Quiet: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's say loglevel 3 and above.

@oatmealraisin
Copy link
Author

So I think (hope) I've proven that the code is safe to delete as is. Using the code in the original as the test case, we can show that this code runs fine.

oc start-build logging-auth-proxy --follow --from-dir /tmp/foo
Uploading directory "/tmp/foo" as binary input for the build ...
logging-auth-proxy-1
warning: OpenShift server version "v1.3.0-alpha.2+f2b7fdd-dirty" differs from this image "v1.3.0-alpha.2"
Receiving source from STDIN as archive ...
Step 1 : FROM library/node:0.10.36
 ---> 600febd9d7b6
Step 2 : MAINTAINER Luke Meyer <[email protected]>
 ---> Using cache
 ---> d980df35d93f
Step 3 : ENTRYPOINT openshift-auth-proxy
 ---> Using cache
 ---> 3396f4e65132
Step 4 : COPY . /opt/openshift-auth-proxy
 ---> Using cache
 ---> 824a983cf3a7
Step 5 : RUN cd /opt/openshift-auth-proxy     && npm install -g .
 ---> Using cache
 ---> 649992ed0d05
Step 6 : ENV "OPENSHIFT_BUILD_NAME" "logging-auth-proxy-1" "OPENSHIFT_BUILD_NAMESPACE" "default"
 ---> Using cache
 ---> 5a874cec0111
Step 7 : LABEL "io.openshift.build.source-context-dir" "deployer/common/openshift-auth-proxy"
 ---> Using cache
 ---> c9e91c6676a7
Successfully built c9e91c6676a7
Pushing image 172.30.154.146:5000/default/logging-auth-proxy:latest ...
Push successful

However, it would probably still run fine if there was no code in the directory. So we change the line at 504 to os.RemoveAll(os.Join(tempDirectory, "deployer", "common)), which contains the files that were not being copied originally. Without these, the build would fail.

On running this code, we get the same output as before:

oc start-build logging-auth-proxy --follow --from-dir /tmp/foo
Uploading directory "/tmp/foo" as binary input for the build ...
logging-auth-proxy-1
warning: OpenShift server version "v1.3.0-alpha.2+f2b7fdd-dirty" differs from this image "v1.3.0-alpha.2"
Receiving source from STDIN as archive ...
Step 1 : FROM library/node:0.10.36
 ---> 600febd9d7b6
Step 2 : MAINTAINER Luke Meyer <[email protected]>
 ---> Using cache
 ---> d980df35d93f
Step 3 : ENTRYPOINT openshift-auth-proxy
 ---> Using cache
 ---> 3396f4e65132
Step 4 : COPY . /opt/openshift-auth-proxy
 ---> Using cache
 ---> 824a983cf3a7
Step 5 : RUN cd /opt/openshift-auth-proxy     && npm install -g .
 ---> Using cache
 ---> 649992ed0d05
Step 6 : ENV "OPENSHIFT_BUILD_NAME" "logging-auth-proxy-1" "OPENSHIFT_BUILD_NAMESPACE" "default"
 ---> Using cache
 ---> 5a874cec0111
Step 7 : LABEL "io.openshift.build.source-context-dir" "deployer/common/openshift-auth-proxy"
 ---> Using cache
 ---> c9e91c6676a7
Successfully built c9e91c6676a7
Pushing image 172.30.154.146:5000/default/logging-auth-proxy:latest ...
Push successful

Great, but it still may be empty and succeeding. So we move line 504 to 532, immediately after the clone, before the tar.

Running this code, we get a failure:

oc start-build logging-auth-proxy --follow --from-repo /tmp/foo
Uploading "/tmp/foo" at commit "HEAD" as binary input for the build ...
logging-auth-proxy-4
warning: OpenShift server version "v1.3.0-alpha.2+f2b7fdd-dirty" differs from this image "v1.3.0-alpha.2"
Receiving source from STDIN as archive ...
error: build error: open /tmp/docker-build124180944/deployer/common/openshift-auth-proxy/Dockerfile: no such file or directory

This should be because we have deleted the content before the tar-ing takes place.

@bparees ptal?

w.Close()
pw.CloseWithError(io.EOF)
}
transferFinished <- false
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 true? (I realize you're doing nothing w/ the value, but true seems more sensible. or better still, the value of "err"

Copy link
Author

Choose a reason for hiding this comment

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

I could change it to true, but the only effect that I wanted was to send a signal through to indicating that a deletion is OK. I don't think we should do error handling on the other side of the channel, because it is specifically for garbage collection.

@bparees bparees added this to the 1.4.0 milestone Aug 11, 2016
@bparees
Copy link
Contributor

bparees commented Aug 11, 2016

Marking 1.4 because i don't think we want to risk this change in 1.3 at this point.

@bparees bparees changed the title oc start-build --from-repo now uses clone+checkout [DO_NOT_MERGE] oc start-build --from-repo now uses clone+checkout Aug 11, 2016
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 16, 2016
@bparees
Copy link
Contributor

bparees commented Sep 20, 2016

@oatmealraisin needs a rebase

@oatmealraisin
Copy link
Author

@bparees Rebased

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 20, 2016
select {
case <-transferFinished:
case <-time.After(timeout):
glog.Warning("Transferring directory %q timed out after %q seconds.", clean, timeout.Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

is there really a need for this? the previous iteration of the code didn't worry about the timeout case. can you just move the removeAll down below where the transfer actually happens, with a flag to indicate if you should removeall (because you cloned to a tempdir) or not removeall (because you just uploaded from a dir the user specified)

@bparees
Copy link
Contributor

bparees commented Sep 20, 2016

[testextended][extended:core(builds)]

@bparees
Copy link
Contributor

bparees commented Sep 20, 2016

[test]

@bparees bparees changed the title [DO_NOT_MERGE] oc start-build --from-repo now uses clone+checkout oc start-build --from-repo now uses clone+checkout Sep 20, 2016
@bparees bparees self-assigned this Sep 21, 2016
@oatmealraisin
Copy link
Author

I believe there was a flake, #9548

@bparees I changed to a boolean flag, ptal?

@bparees
Copy link
Contributor

bparees commented Sep 21, 2016

the change looks good to me, but you've been victimized by your other pull merging:

++ Building go targets for linux/amd64: cmd/oc
# github.com/openshift/origin/pkg/cmd/cli/cmd
pkg/cmd/cli/cmd/startbuild.go:512: undefined: "github.com/openshift/origin/pkg/generate/git".CloneOptions

so you'll need to rework that code.

@oatmealraisin
Copy link
Author

@bparees Yep just noticed that, I'm on it

@oatmealraisin
Copy link
Author

Flake #9548

[test]

@oatmealraisin
Copy link
Author

Flake #9457, [test]

@bparees
Copy link
Contributor

bparees commented Sep 28, 2016

@oatmealraisin pretty sure the extended test failure is caused by these changes, it's not a known flake.

@oatmealraisin
Copy link
Author

@bparees Yes sorry, I'm working on the Jenkins PR atm

@oatmealraisin
Copy link
Author

[test]

@oatmealraisin
Copy link
Author

Flake #11517 , [test]

@oatmealraisin
Copy link
Author

@bparees I've gotten the extended tests working, ptal?

@oatmealraisin
Copy link
Author

@bparees The code will search upwards for the root dir. I'm having trouble testing locally, don't know if this will pass, but ptal?

Copy link
Contributor

@bparees bparees 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 and lgtm.

// NOTE: This actually takes the commit from the origin repository. If the
// test-build-app changes, this commit has to be bumped.
br, err := exutil.StartBuildAndWait(oc, "sample-build", "--commit=f0f3834", fmt.Sprintf("--from-repo=%s", exampleBuild))
gitCmd := exec.Command("git", "rev-parse", "HEAD")
Copy link
Contributor

Choose a reason for hiding this comment

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

do HEAD~1 so we're not just building HEAD. otherwise the git commit matching check later is suspect.

Copy link
Author

Choose a reason for hiding this comment

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

Would a tag be better? That way it doesn't change at all

Copy link
Contributor

Choose a reason for hiding this comment

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

but we'd be broken if the tag went away for some reason.

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 someone does break this w/ a commit to origin we probably want to know

@oatmealraisin
Copy link
Author

Flake #11406, [test]

@oatmealraisin
Copy link
Author

Waiting for Custom Build Strategy fix

@bparees
Copy link
Contributor

bparees commented Nov 3, 2016

@oatmealraisin please squash in the meantime.

@bparees
Copy link
Contributor

bparees commented Nov 3, 2016

@oatmealraisin i'm comfortable w/ merging this based on the only failure being a known issue, once you squash.

@oatmealraisin
Copy link
Author

@bparees Roger that, squashing

This allows us to handle submodules.  However, it takes up a bit more
resources.  This shouldn't be a problem - even the Linux kernel only
took about 3 seconds to clone to another local directory.
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 5d22f46

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to 5d22f46

@bparees
Copy link
Contributor

bparees commented Nov 3, 2016

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 5d22f46

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11086/) (Base Commit: 029c0dc)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/737/) (Base Commit: 029c0dc) (Extended Tests: core(builds))

@oatmealraisin
Copy link
Author

Still getting hit by custom builds

@bparees
Copy link
Contributor

bparees commented Nov 3, 2016

@oatmealraisin you're in the merge queue.

@bparees
Copy link
Contributor

bparees commented Nov 3, 2016

and @coreydaley is working on the custom build strategy failures.

@oatmealraisin
Copy link
Author

@bparees Roger, just posting that I haven't abandoned the PR 👁️ 👁️

@openshift-bot
Copy link
Contributor

openshift-bot commented Nov 5, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11167/) (Base Commit: 262bb72) (Image: devenv-rhel7_5321)

@openshift-bot openshift-bot merged commit 046fad4 into openshift:master Nov 5, 2016
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.

3 participants