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

gitreceived: adding support for submodules, by switching to full repos (instead of --bare) #1617

Merged
merged 1 commit into from Aug 25, 2015

Conversation

Projects
None yet
3 participants
@temujin9
Copy link
Contributor

temujin9 commented Jun 24, 2015

Switching to full repositories (rather than bare) so that "git checkout" and "git submodule update --init" can be performed prior to passing to the receiver.

(Per conversation with @lmars, we will probably refactor how gitreceived -> receiver -> slugbuilder works, so this went in the simplest-to-implement place. We will still need to address distributing keys into containers, separately.)

Closes #62.

@titanous

This comment has been minimized.

Copy link
Member

titanous commented Jun 24, 2015

I'm fine with this approach, though it does need an integration test. I'll let @lmars review the shell script.

I think we should hold off on implementing this in slugbuilder, and instead do it as an optional pipeline step in #1515.

@temujin9

This comment has been minimized.

Copy link
Contributor Author

temujin9 commented Jun 24, 2015

@titanous Can you get me pointed in the right direction on the integration tests? I'm not sure where to look.

@titanous

This comment has been minimized.

Copy link
Member

titanous commented Jun 24, 2015

Sure, here's an example of testing the build cache:

func (s *GitDeploySuite) TestBuildCaching(t *c.C) {
r := s.newGitRepo(t, "build-cache")
t.Assert(r.flynn("create"), Succeeds)
t.Assert(r.flynn("env", "set", "BUILDPACK_URL=https://github.com/kr/heroku-buildpack-inline"), Succeeds)
r.git("commit", "-m", "bump", "--allow-empty")
push := r.git("push", "flynn", "master")
t.Assert(push, Succeeds)
t.Assert(push, c.Not(OutputContains), "cached")
r.git("commit", "-m", "bump", "--allow-empty")
push = r.git("push", "flynn", "master")
t.Assert(push, SuccessfulOutputContains, "cached: 0")
r.git("commit", "-m", "bump", "--allow-empty")
push = r.git("push", "flynn", "master")
t.Assert(push, SuccessfulOutputContains, "cached: 1")
}

set -eo pipefail;
git-archive-all() {
git checkout $1 > /dev/null
git submodule update --init --recursive > /dev/null

This comment has been minimized.

Copy link
@lmars

lmars Jun 24, 2015

Member

Either pass --quiet to both these commands or discard stderr too (i.e. &>/dev/null)

@lmars

This comment has been minimized.

Copy link
Member

lmars commented Jun 24, 2015

@temujin9 I actually wrote a test to check this out:

func (s *GitDeploySuite) TestGitSubmodules(t *c.C) {
    r := s.newGitRepo(t, "empty")
    t.Assert(r.git("submodule", "add", "https://github.com/flynn-examples/go-flynn-example.git"), Succeeds)
    t.Assert(r.git("commit", "-m", "Add Submodule"), Succeeds)
    t.Assert(r.flynn("create"), Succeeds)
    t.Assert(r.git("push", "flynn", "master"), Succeeds)
    t.Assert(r.flynn("run", "ls", "go-flynn-example"), SuccessfulOutputContains, "main.go")
}
gitreceived: adding support for submodules, by switching to full repo…
…s (instead of --bare)

Signed-off-by: Nathaniel Eliot <nathaniel.eliot@bazaarvoice.com>
@temujin9

This comment has been minimized.

Copy link
Contributor Author

temujin9 commented Aug 25, 2015

The --quiet flag is now thrown, and @lmars' test works without error, so this should be ready to go.

titanous added a commit that referenced this pull request Aug 25, 2015

Merge pull request #1617 from bazaarvoice/neliot-gitreceive-submodule
gitreceived: adding support for submodules, by switching to full repos (instead of --bare)

@titanous titanous merged commit c291a02 into flynn:master Aug 25, 2015

1 check passed

continuous-integration/flynn The Flynn CI build passed
Details
@titanous

This comment has been minimized.

Copy link
Member

titanous commented Aug 25, 2015

Awesome, thanks!

@temujin9 temujin9 deleted the bazaarvoice:neliot-gitreceive-submodule branch Aug 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.