Skip to content

Commit

Permalink
fix(vcs): include submodules with remote sources
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Aug 19, 2019
1 parent 9fcdc45 commit c39e5a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion garden-service/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export class GitHandler extends VcsHandler {
log: LogEntry, remoteSourcesPath: string, repositoryUrl: string, hash: string, absPath: string,
) {
const git = this.gitCli(log, remoteSourcesPath)
return git("clone", "--depth=1", `--branch=${hash}`, repositoryUrl, absPath)
// Use `--recursive` to include submodules
return git("clone", "--recursive", "--depth=1", `--branch=${hash}`, repositoryUrl, absPath)
}

// TODO Better auth handling
Expand Down Expand Up @@ -202,6 +203,8 @@ export class GitHandler extends VcsHandler {
try {
await git("fetch", "--depth=1", "origin", hash)
await git("reset", "--hard", `origin/${hash}`)
// Update submodules if applicable (no-op if no submodules in repo)
await git("submodule", "update", "--recursive")
} catch (err) {
entry.setError()
throw new RuntimeError(`Updating remote ${sourceType} failed with error: \n\n${err}`, {
Expand Down
5 changes: 5 additions & 0 deletions garden-service/test/e2e/src/pre-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ describe("PreReleaseTests", () => {

if (project === "remote-sources") {
describe("remote sources", () => {
it("runs the update-remote command", async () => {
const logEntries = await runWithEnv(["update-remote", "all"])
const res = searchLog(logEntries, /Source already up to date/)
expect(res, "expected to find 'Source already up to date' in log output").to.eql("passed")
})
it("calls the result service to get a 200 OK response including the HTML for the result page", async () => {
const logEntries = await runWithEnv(["call", "result"])
expect(searchLog(logEntries, /200 OK/), "expected to find '200 OK' in log output").to.eql("passed")
Expand Down

0 comments on commit c39e5a7

Please sign in to comment.