diff --git a/garden-service/src/garden.ts b/garden-service/src/garden.ts index 42be980508..7e91d33a23 100644 --- a/garden-service/src/garden.ts +++ b/garden-service/src/garden.ts @@ -387,6 +387,8 @@ export class Garden { return } + this.log.silly(`Resolving providers`) + const rawConfigs = this.getRawProviderConfigs() const plugins = await Bluebird.map(rawConfigs, async (config) => this.loadPlugin(config.name)) @@ -488,6 +490,8 @@ export class Garden { const actions = await this.getActionHelper() const configs = await this.getRawModuleConfigs(keys) + keys ? this.log.silly(`Resolving module configs ${keys.join(", ")}`) : this.log.silly(`Resolving module configs`) + if (!opts.configContext) { opts.configContext = new ModuleConfigContext( this, @@ -606,6 +610,8 @@ export class Garden { * and the versions of its dependencies (in sorted order). */ async resolveVersion(moduleName: string, moduleDependencies: (Module | BuildDependencyConfig)[], force = false) { + this.log.silly(`Resolving version for module ${moduleName}`) + const depModuleNames = moduleDependencies.map(m => m.name) depModuleNames.sort() const cacheKey = ["moduleVersions", moduleName, ...depModuleNames] @@ -620,7 +626,7 @@ export class Garden { const config = await this.resolveModuleConfig(moduleName) const dependencyKeys = moduleDependencies.map(dep => getModuleKey(dep.name, dep.plugin)) - const dependencies = await this.resolveModuleConfigs(dependencyKeys) + const dependencies = await this.getRawModuleConfigs(dependencyKeys) const cacheContexts = dependencies.concat([config]).map(c => getModuleCacheContext(c)) const version = await this.vcs.resolveVersion(config, dependencies) @@ -670,6 +676,8 @@ export class Garden { await Bluebird.map(rawConfigs, async (config) => this.addModule(config)) + this.log.silly(`Scanned and found ${rawConfigs.length} modules`) + this.modulesScanned = true }) } @@ -687,6 +695,7 @@ export class Garden { */ private async addModule(config: ModuleConfig) { const key = getModuleKey(config.name, config.plugin) + this.log.silly(`Adding module ${key}`) if (this.moduleConfigs[key]) { const paths = [this.moduleConfigs[key].path, config.path] @@ -712,6 +721,7 @@ export class Garden { path = resolve(this.projectRoot, path) this.log.silly(`Load module configs from ${path}`) const resources = await loadConfig(this.projectRoot, path) + this.log.silly(`Loaded module configs from ${path}`) return resources.filter(r => r.kind === "Module") } diff --git a/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/Dockerfile b/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/Dockerfile new file mode 100644 index 0000000000..24a79d08b6 --- /dev/null +++ b/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/Dockerfile @@ -0,0 +1 @@ +FROM busybox diff --git a/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/garden.yml b/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/garden.yml new file mode 100644 index 0000000000..00f85f5350 --- /dev/null +++ b/garden-service/test/unit/data/test-projects/1067-module-ref-within-file/garden.yml @@ -0,0 +1,20 @@ +kind: Project +name: issue-1067 +--- +kind: Module +name: container-module +type: container +allowPublish: false +build: + dependencies: + - name: exec-module +--- +kind: Module +type: exec +allowPublish: false +include: [] +name: exec-module +build: + command: + - echo + - "${modules.container-module.path}" \ No newline at end of file diff --git a/garden-service/test/unit/src/garden.ts b/garden-service/test/unit/src/garden.ts index 0c90240a84..b7db703623 100644 --- a/garden-service/test/unit/src/garden.ts +++ b/garden-service/test/unit/src/garden.ts @@ -839,6 +839,14 @@ describe("Garden", () => { // We template in the value for the module's allowPublish field to test this expect(module.allowPublish).to.equal(false) }) + + it("should handle module references within single file", async () => { + const projectRoot = getDataDir("test-projects", "1067-module-ref-within-file") + const garden = await makeTestGarden(projectRoot) + + // This should just complete successfully + await garden.resolveModuleConfigs() + }) }) describe("resolveVersion", () => {