Skip to content

disambiguate directory and branch names via -- #14103

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

Merged
merged 1 commit into from
May 14, 2017

Conversation

gabemontero
Copy link
Contributor

Fixes #13933

@openshift/devex ptal

@bparees
Copy link
Contributor

bparees commented May 8, 2017

[test]
[testextended][extended:core(builds)]

@bparees bparees self-assigned this May 8, 2017
@bparees
Copy link
Contributor

bparees commented May 9, 2017

[test]

@bparees
Copy link
Contributor

bparees commented May 9, 2017

not sure why it reported unstable but the new test is failing:

=== RUN   TestCheckoutWithBranchAndDirWithSameName
--- FAIL: TestCheckoutWithBranchAndDirWithSameName (0.56s)
	repository_test.go:291: problem switching to openshift: fatal: invalid reference: openshift
	repository_test.go:300: expected to be on branch openshift, but instead: "# On branch master\nnothing to commit, working directory clean\n"
FAIL

https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_check/1830/

@jim-minter
Copy link
Contributor

The test is very verbose and there's a fair amount of code copying from pkg/build/builder/source_test.go. The functions gitStatus and createBranch actually appear to be unused. I'd almost be tempted to condense all the exec.* preamble calls into a single call of something like:

	cmd := exec.Command("bash", "-e", "-c", `
	echo test >initial-file
	git init
	git config user.email [email protected]
	git config user.name 'Me Myself'
	git add initial-file
	git commit -a -m 'repo create'
	# etc, etc.
	`)
	cmd.Path = ??
	if err := cmd.Run(); err != nil {
		t.Fatal(err)
	}

I think that would make it simpler and clearer.

@gabemontero
Copy link
Contributor Author

gabemontero commented May 9, 2017 via email

@gabemontero
Copy link
Contributor Author

Still passing for me locally ... between @jim-minter comments/suggestions and some debug, I'll initiate a new run in a bit.

@gabemontero gabemontero force-pushed the br-dir-same-name-prob branch from 3df2f27 to 8c9a13b Compare May 9, 2017 13:28
@gabemontero
Copy link
Contributor Author

I've pushed an intermediate change. It has a potential resolution to the ci.openshift failure, along with some debug, but only addresses part of @jim-minter 's comments.

Assuming it passes, or the debug is at least enlightening, I'll then go back and make further updates per comments.

@gabemontero
Copy link
Contributor Author

gabemontero commented May 9, 2017

This is beginning to smell like the check out of pr ref changes, where the git mechanics around checkout are .... curious.

Here is the debug from the failure for the test currently running:

=== RUN   TestCheckoutWithBranchAndDirWithSameName
--- FAIL: TestCheckoutWithBranchAndDirWithSameName (0.66s)
	repository_test.go:279: branches in new repo "  origin/HEAD -> origin/master\n  origin/master\n  origin/openshift\n"
	repository_test.go:282: problem switching to openshift from within /openshifttmp/newlocation314232075/test-test431071580, where all branches are   origin/HEAD -> origin/master
		  origin/master
		  origin/openshift
		: fatal: invalid reference: openshift
	repository_test.go:291: expected to be on branch openshift, but instead: "# On branch master\nnothing to commit, working directory clean\n"
FAIL

The above failure also includes a git fetch prior to the git checkout openshift per http://stackoverflow.com/questions/1783405/how-to-check-out-a-remote-git-branch ... but that has no effect.

I tried a git checkout origin/openshift on my local system, but

a) it results in a git status of HEAD detached at origin/openshift

b) specifying origin/openshift contradicts the original problem, where the branch name specified directly matches an existing file/dir in the repo.

I'm a bit stuck at the moment on how to resolve this.

@bparees @jim-minter @csrwng - any ideas ?

@bparees
Copy link
Contributor

bparees commented May 9, 2017

@gabemontero have you checked the git level on the ec2 machine? as i recall the stack overflow article indicated the -- support was relatively new.

@gabemontero
Copy link
Contributor Author

gabemontero commented May 9, 2017 via email

@gabemontero
Copy link
Contributor Author

Though I'm seeing stack overflow and double hyphen from as far back as 2013 ... http://stackoverflow.com/questions/17800994/git-two-dashes-means-with-no-more-options

@bparees
Copy link
Contributor

bparees commented May 9, 2017

yeah perhaps not as new as i thought.

@gabemontero gabemontero force-pushed the br-dir-same-name-prob branch from 8c9a13b to f6b9cec Compare May 9, 2017 20:06
@gabemontero
Copy link
Contributor Author

The git version is quite old: git version 1.8.3.1

Where looking at https://github.com/git/git/commits/master/Documentation/RelNotes/1.8.3.1.txt, its introduction goes as far back as June 2013. It is conceivable the -- is not supported.

That said, it is somewhat unclear to me whether that is the precise reason for the error.

Still somewhat pessimistic though given
a) what might be involved with upgrading git on our ec2
b) if that isn't it, do we have to munge the .git config to allow for pulling of branches like what we did for the PR ref prototyping ... all seems ugly

Given I was at least able to reproduce and verify the fix locally ... I'm beginning to wonder if this is worth the effort and if we should just push the actual runtime change ... :-)

@bparees
Copy link
Contributor

bparees commented May 9, 2017

we could also do an extended or integration test (where the clone would actually be getting done by our image w/ a recent git version).

@bparees
Copy link
Contributor

bparees commented May 9, 2017

(I do think it's worth having a test for this scenario, i think this is now the second time i've spent a bunch of time investigating why someone's git checkout wasn't doing what we expected before realizing it was a filename conflict w/ their branch name....so i'd really like to be sure we don't regress this :) )

@gabemontero
Copy link
Contributor Author

gabemontero commented May 9, 2017 via email

@bparees
Copy link
Contributor

bparees commented May 9, 2017

If not, I suppose we'd have to create one, no?

yeah i think this would be another case of us making a special branch, perhaps in ruby-hello-world again, to drive the test. Though it's possible we could also drive the test by creating a local git repo w/ an appropriately named branch, and then run "oc start-build --from-repo ." (--from-repo does a binary build using local content, but treating that content as a git repo).

@gabemontero
Copy link
Contributor Author

gabemontero commented May 10, 2017 via email

@bparees
Copy link
Contributor

bparees commented May 10, 2017

For the branch in ruby-hello-world, I'm thinking of naming it "config", as there is already a config dir, and then remove a file like README.md, and test for that fact. Thoughts @bparees?

sounds fine.

@gabemontero gabemontero force-pushed the br-dir-same-name-prob branch from f6b9cec to b07462e Compare May 11, 2017 00:51
@gabemontero
Copy link
Contributor Author

new-app based extended test with our new "config" branch with ruby-hello-world pushed

@gabemontero
Copy link
Contributor Author

prior added unit test removed .... was able to verify test broke with fix temporarily reverted

@gabemontero
Copy link
Contributor Author

@bparees - same situation as before. The test I added which is passing for me locally is failing up on ec2 / ci.openshift.

Could it be that the builder images being constructed up on ec2 / ci.openshift are pulling in the same downlevel git command that was potentially causing problems with the unit test?

I can certainly demo the new test for you on my laptop if a sanity check (of me ;-)) is desired.

@bparees
Copy link
Contributor

bparees commented May 11, 2017

Could it be that the builder images being constructed up on ec2 / ci.openshift are pulling in the same downlevel git command that was potentially causing problems with the unit test?

They're going to pull the same level of git as when you build the image yourself. So if it was working in your tests, it should be working in what is being built on ec2. (That said, I do see the git version in our origin-sti-builder is 1.8.3.1)

@gabemontero
Copy link
Contributor Author

gabemontero commented May 11, 2017

OK, first, as a sanity check, a gist of the test running locally for me: https://gist.github.com/gabemontero/554da18047a9502f14a60e003ab5da55

Followed by a git status and git log -2. Note, I did rebase this AM just to pull in the latest origin locally in case that had some bearing with my local results. The file diff is the same.

I'll post an update in a bit with some added debug:

  1. update the builder image to print a git version as part of the build, just to confirm / correlate with what @bparees noted wrt origin-sti-builder
  2. update the test to dump the build log irregardless, to note the expected commit appearing that is only relevant to the new config branch we created.

@gabemontero
Copy link
Contributor Author

OK, here is the debug version with the 2 updates I mentioned in my last comment: https://gist.github.com/gabemontero/5509c6906cdec3817e609eae65ef39b1

Of note:

  1. the commit used is Commit: 5619f11232c0a623f7da419438539335d49acfa3 (Merge pull request #61 from gabemontero/config) ... the one we expected when using git checkout config --, but that is not getting used when run up on ec2, etc.

  2. note the git version from within openshit-sti-builder ... it is the same, older, version we've been speculating about: I0511 17:12:31.662637 1 repository.go:297] GGM git version git version 1.8.3.1 <nil>

Given we've seen this now with both the unit test and extended test versions of this ... I'm officially at a loss :-(

@bparees
Copy link
Contributor

bparees commented May 11, 2017

@gabemontero in the latest extended test run i only see pipeline test failures, i don't see that your new extended test failed. Am I missing something?

@bparees
Copy link
Contributor

bparees commented May 11, 2017

I see..it failed in the conformance run. but it passed in the extended test run. that is particularly strange.

@gabemontero
Copy link
Contributor Author

gabemontero commented May 11, 2017 via email

@bparees
Copy link
Contributor

bparees commented May 11, 2017

with the new test going in new_app.go it falls in the conformance test category and shows up under "tests" vs "testextendedonly"

it actually runs in both and passed in the extended bucket.

@bparees
Copy link
Contributor

bparees commented May 11, 2017

updating the test to run with build loglevel 5 might provide a little more insight, but i'm baffled as to why it would pass in one context and fail in the other.

@gabemontero
Copy link
Contributor Author

gabemontero commented May 11, 2017 via email

@bparees
Copy link
Contributor

bparees commented May 11, 2017

any chance the sti-builder image is not updated in the failing context?

hard to imagine and slightly terrifying if true... but i can't claim it's impossible.

@gabemontero gabemontero force-pushed the br-dir-same-name-prob branch from b07462e to a10b905 Compare May 12, 2017 01:14
@gabemontero
Copy link
Contributor Author

ok just pushed a debug commit that sets BUILD_LOGLEVEL and adds a trace point in repository.go's Checkout.... should hopefully answer at least some of our recent questions

@gabemontero
Copy link
Contributor Author

Clayton confirmed none of the images are getting freshly built for the gce conformance tests. Will move the test to a different bucket.

@gabemontero gabemontero force-pushed the br-dir-same-name-prob branch from a10b905 to adce895 Compare May 12, 2017 15:13
@gabemontero
Copy link
Contributor Author

test case moved ... will report on testing results as they complete.

and of course comments on these new changes welcome.

@bparees
Copy link
Contributor

bparees commented May 12, 2017

lgtm

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to adce895

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to adce895

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/1400/) (Base Commit: f24a57f)

@gabemontero
Copy link
Contributor Author

test error was flake #14161 in conformance install... new test case not executed in that suite

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended/382/) (Base Commit: f24a57f) (Extended Tests: core(builds))

@gabemontero
Copy link
Contributor Author

test extended error was our known jenkins pipeline flake #13984

the new test in this pull passed, as did all the other build extended tests

@gabemontero
Copy link
Contributor Author

so only known flakes in the last set of test/testextended ... per #14103 (comment) please post the merge comment , shall the merge comment get posted @bparees ?

thanks

@bparees
Copy link
Contributor

bparees commented May 12, 2017

@gabemontero sounds good.
[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to adce895

@gabemontero
Copy link
Contributor Author

gabemontero commented May 12, 2017 via email

@openshift-bot
Copy link
Contributor

openshift-bot commented May 14, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/642/) (Base Commit: af82d3d) (Image: devenv-rhel7_6228)

@openshift-bot openshift-bot merged commit c792fc9 into openshift:master May 14, 2017
@gabemontero gabemontero deleted the br-dir-same-name-prob branch May 15, 2017 13:30
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.

4 participants