From 65c01c6ce882356e522b57986c8cc67f9840f7f7 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 3 Nov 2023 21:15:41 +0300 Subject: [PATCH 1/2] fix: path.module incorrectly populated for modules --- examples/module-local/calculator/togomak.hcl | 8 ++++++++ examples/module-local/togomak.hcl | 8 ++++++++ internal/ci/conductor.go | 8 ++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/module-local/calculator/togomak.hcl b/examples/module-local/calculator/togomak.hcl index eb4a0cb..95c9add 100644 --- a/examples/module-local/calculator/togomak.hcl +++ b/examples/module-local/calculator/togomak.hcl @@ -20,3 +20,11 @@ stage "add" { if = var.operation == "add" script = "echo ${var.a} + ${var.b} is ${var.a + var.b}" } + +stage "paths" { + script = <<-EOT + echo path.module: ${path.module} + echo path.cwd: ${path.cwd} + echo path.root: ${path.root} + EOT +} diff --git a/examples/module-local/togomak.hcl b/examples/module-local/togomak.hcl index 93a2e96..4fdebbc 100644 --- a/examples/module-local/togomak.hcl +++ b/examples/module-local/togomak.hcl @@ -7,6 +7,14 @@ locals { b = 1 } +stage "paths" { + script = <<-EOT + echo path.module: ${path.module} + echo path.cwd: ${path.cwd} + echo path.root: ${path.root} + EOT +} + module "add" { source = "./calculator" a = local.a diff --git a/internal/ci/conductor.go b/internal/ci/conductor.go index e7dce7c..c600a5b 100644 --- a/internal/ci/conductor.go +++ b/internal/ci/conductor.go @@ -281,10 +281,6 @@ func NewConductor(cfg ConductorConfig, opts ...ConductorOption) *Conductor { Process: process, RootLogger: logger, Config: cfg, - eval: &Eval{ - context: CreateEvalContext(cfg, process), - mu: &sync.RWMutex{}, - }, } for _, v := range cfg.Variables { c.variables = append(c.variables, v) @@ -293,6 +289,10 @@ func NewConductor(cfg ConductorConfig, opts ...ConductorOption) *Conductor { for _, opt := range opts { opt(c) } + c.eval = &Eval{ + context: CreateEvalContext(c.Config, process), + mu: &sync.RWMutex{}, + } if !c.Config.Behavior.Child.Enabled { logger.Infof("%s (version=%s)", meta.AppName, meta.AppVersion) From a6abb4f4367fca1a6c2349a9006c772dacec415d Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 3 Nov 2023 21:16:49 +0300 Subject: [PATCH 2/2] chore: sync changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a4d4d..308894c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- Fix `path.module` incorrectly being populated for togomak modules + +## [v2.0.0-alpha.9] - Add support for `modules` - Add JSON logger - Add `for_each` to modules