Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package terragrunt for openSUSE:Factory checked in at 2023-03-01 16:14:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/terragrunt (Old) and /work/SRC/openSUSE:Factory/.terragrunt.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "terragrunt" Wed Mar 1 16:14:04 2023 rev:30 rq:1068208 version:0.44.1 Changes: -------- --- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes 2023-02-23 16:53:06.521032276 +0100 +++ /work/SRC/openSUSE:Factory/.terragrunt.new.31432/terragrunt.changes 2023-03-01 16:14:28.814732653 +0100 @@ -1,0 +2,6 @@ +Tue Feb 28 14:35:28 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.44.1: + * #2467 Parallel TFLint execution errors (#2469) + +------------------------------------------------------------------- Old: ---- terragrunt-0.44.0.tar.gz New: ---- terragrunt-0.44.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ terragrunt.spec ++++++ --- /var/tmp/diff_new_pack.zhJozr/_old 2023-03-01 16:14:29.826737886 +0100 +++ /var/tmp/diff_new_pack.zhJozr/_new 2023-03-01 16:14:29.834737927 +0100 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: terragrunt -Version: 0.44.0 +Version: 0.44.1 Release: 0 Summary: Thin wrapper for Terraform for working with multiple Terraform modules License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.zhJozr/_old 2023-03-01 16:14:29.870738113 +0100 +++ /var/tmp/diff_new_pack.zhJozr/_new 2023-03-01 16:14:29.874738133 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/gruntwork-io/terragrunt</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.44.0</param> + <param name="revision">v0.44.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> @@ -16,7 +16,7 @@ <param name="compression">gz</param> </service> <service name="go_modules" mode="disabled"> - <param name="archive">terragrunt-0.44.0.tar.gz</param> + <param name="archive">terragrunt-0.44.1.tar.gz</param> </service> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.zhJozr/_old 2023-03-01 16:14:29.894738237 +0100 +++ /var/tmp/diff_new_pack.zhJozr/_new 2023-03-01 16:14:29.898738258 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/gruntwork-io/terragrunt</param> - <param name="changesrevision">21acbcfc9bb461577bd44d98ea8866aa7536d574</param></service></servicedata> + <param name="changesrevision">2508dd89486efd10485a78856f4ff0fb3ddf3d45</param></service></servicedata> (No newline at EOF) ++++++ terragrunt-0.44.0.tar.gz -> terragrunt-0.44.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/.circleci/config.yml new/terragrunt-0.44.1/.circleci/config.yml --- old/terragrunt-0.44.0/.circleci/config.yml 2023-02-22 21:23:37.000000000 +0100 +++ new/terragrunt-0.44.1/.circleci/config.yml 2023-02-28 15:23:02.000000000 +0100 @@ -85,6 +85,14 @@ - run: command: terratest_log_parser --testlog logs/integration.log --outputdir logs when: always + # Run TFLint tests separately as tflint during execution change working directory. + - run: + command: | + run-go-tests --packages "-tags tflint -run TestTflint ./test" | tee logs/integration.log + no_output_timeout: 30m + - run: + command: terratest_log_parser --testlog logs/integration.log --outputdir logs + when: always - store_artifacts: path: logs - store_test_results: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/cli/cli_app.go new/terragrunt-0.44.1/cli/cli_app.go --- old/terragrunt-0.44.0/cli/cli_app.go 2023-02-22 21:23:37.000000000 +0100 +++ new/terragrunt-0.44.1/cli/cli_app.go 2023-02-28 15:23:02.000000000 +0100 @@ -7,6 +7,7 @@ "os" "regexp" "strings" + "sync" "time" "github.com/gruntwork-io/terragrunt/tflint" @@ -296,6 +297,9 @@ CMD_TERRAGRUNT_VALIDATE_INPUTS: validateInputsHelp, } +// map to keep track of locks for source changes +var sourceChangeLocks = sync.Map{} + // Create the Terragrunt CLI App func CreateTerragruntCli(version string, writer io.Writer, errwriter io.Writer) *cli.App { cli.OsExiter = func(exitCode int) { @@ -494,21 +498,8 @@ // Handle code generation configs, both generate blocks and generate attribute of remote_state. // Note that relative paths are relative to the terragrunt working dir (where terraform is called). - for _, config := range terragruntConfig.GenerateConfigs { - if err := codegen.WriteToFile(updatedTerragruntOptions, updatedTerragruntOptions.WorkingDir, config); err != nil { - return err - } - } - if terragruntConfig.RemoteState != nil && terragruntConfig.RemoteState.Generate != nil { - if err := terragruntConfig.RemoteState.GenerateTerraformCode(updatedTerragruntOptions); err != nil { - return err - } - } else if terragruntConfig.RemoteState != nil { - // We use else if here because we don't need to check the backend configuration is defined when the remote state - // block has a `generate` attribute configured. - if err := checkTerraformCodeDefinesBackend(updatedTerragruntOptions, terragruntConfig.RemoteState.Backend); err != nil { - return err - } + if err = generateConfig(terragruntConfig, updatedTerragruntOptions); err != nil { + return err } // We do the terragrunt input validation here, after all the terragrunt generated terraform files are created so @@ -539,6 +530,31 @@ return runTerragruntWithConfig(terragruntOptions, updatedTerragruntOptions, terragruntConfig, false) } +func generateConfig(terragruntConfig *config.TerragruntConfig, updatedTerragruntOptions *options.TerragruntOptions) error { + rawActualLock, _ := sourceChangeLocks.LoadOrStore(updatedTerragruntOptions.DownloadDir, &sync.Mutex{}) + actualLock := rawActualLock.(*sync.Mutex) + defer actualLock.Unlock() + actualLock.Lock() + + for _, config := range terragruntConfig.GenerateConfigs { + if err := codegen.WriteToFile(updatedTerragruntOptions, updatedTerragruntOptions.WorkingDir, config); err != nil { + return err + } + } + if terragruntConfig.RemoteState != nil && terragruntConfig.RemoteState.Generate != nil { + if err := terragruntConfig.RemoteState.GenerateTerraformCode(updatedTerragruntOptions); err != nil { + return err + } + } else if terragruntConfig.RemoteState != nil { + // We use else if here because we don't need to check the backend configuration is defined when the remote state + // block has a `generate` attribute configured. + if err := checkTerraformCodeDefinesBackend(updatedTerragruntOptions, terragruntConfig.RemoteState.Backend); err != nil { + return err + } + } + return nil +} + // Check the version constraints of both terragrunt and terraform. Note that as a side effect this will set the // following settings on terragruntOptions: // - TerraformPath @@ -715,6 +731,10 @@ workingDir = *curHook.WorkingDir } + rawActualLock, _ := sourceChangeLocks.LoadOrStore(workingDir, &sync.Mutex{}) + actualLock := rawActualLock.(*sync.Mutex) + actualLock.Lock() + actionToExecute := curHook.Execute[0] actionParams := curHook.Execute[1:] @@ -737,7 +757,7 @@ errorsOccured = multierror.Append(errorsOccured, possibleError) } } - + actualLock.Unlock() } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/fixture-parallel-run/.tflint.hcl new/terragrunt-0.44.1/test/fixture-parallel-run/.tflint.hcl --- old/terragrunt-0.44.0/test/fixture-parallel-run/.tflint.hcl 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.44.1/test/fixture-parallel-run/.tflint.hcl 2023-02-28 15:23:02.000000000 +0100 @@ -0,0 +1,13 @@ +plugin "aws-cis" { + enabled = true + version = "0.0.2" + source = "github.com/gruntwork-io/tflint-ruleset-aws-cis" +} + +config { + module = true +} + +plugin "terraform" { + enabled = false +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/fixture-parallel-run/common/terragrunt.hcl new/terragrunt-0.44.1/test/fixture-parallel-run/common/terragrunt.hcl --- old/terragrunt-0.44.0/test/fixture-parallel-run/common/terragrunt.hcl 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.44.1/test/fixture-parallel-run/common/terragrunt.hcl 2023-02-28 15:23:02.000000000 +0100 @@ -0,0 +1,63 @@ +terraform { + source = "github.com/gruntwork-io/terragrunt.git//test/fixture-dirs?ref=v0.35.1" +} + +generate "providers" { + path = "providers.tf" + if_exists = "overwrite" + contents = <<EOF +provider "aws" { + region = "us-east-1" +} +EOF +} + +generate "outputs_1" { + path = "outputs_1.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_1" { + value = "outputs_1" +} +EOF +} + +generate "outputs_2" { + path = "outputs_2.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_2" { + value = "outputs_2" +} +EOF +} + +generate "outputs_3" { + path = "outputs_3.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_3" { + value = "outputs_3" +} +EOF +} + +generate "outputs_4" { + path = "outputs_4.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_4" { + value = "outputs_4" +} +EOF +} + +generate "outputs_5" { + path = "outputs_5.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_5" { + value = "outputs_5" +} +EOF +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/fixture-parallel-run/dev/app/terragrunt.hcl new/terragrunt-0.44.1/test/fixture-parallel-run/dev/app/terragrunt.hcl --- old/terragrunt-0.44.0/test/fixture-parallel-run/dev/app/terragrunt.hcl 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.44.1/test/fixture-parallel-run/dev/app/terragrunt.hcl 2023-02-28 15:23:02.000000000 +0100 @@ -0,0 +1,49 @@ +include "root" { + path = find_in_parent_folders() +} + +terraform { + source = "github.com/gruntwork-io/terragrunt.git//test/fixture-dirs?ref=v0.35.1" +} + +dependency "common" { + config_path = "../../common" + mock_outputs_allowed_terraform_commands = ["validate", "plan"] + mock_outputs = { + vpc_id = "fake-vpc-id" + } + + skip_outputs = "true" +} + + +generate "provider" { + path = "providers.tf" + if_exists = "overwrite" + contents = <<EOF +provider "aws" { + region = "us-east-1" +} +EOF +} + + +generate "outputs_1" { + path = "outputs_1.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_1" { + value = "outputs_1" +} +EOF +} + +generate "outputs_2" { + path = "outputs_2.tf" + if_exists = "overwrite" + contents = <<EOF +output "outputs_2" { + value = "outputs_2" +} +EOF +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/fixture-parallel-run/terragrunt.hcl new/terragrunt-0.44.1/test/fixture-parallel-run/terragrunt.hcl --- old/terragrunt-0.44.0/test/fixture-parallel-run/terragrunt.hcl 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.44.1/test/fixture-parallel-run/terragrunt.hcl 2023-02-28 15:23:02.000000000 +0100 @@ -0,0 +1,7 @@ +terraform { + include_in_copy = [".terraform-version"] + before_hook "tflint" { + commands = ["apply", "plan", "init"] + execute = ["tflint"] + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/integration_test.go new/terragrunt-0.44.1/test/integration_test.go --- old/terragrunt-0.44.0/test/integration_test.go 2023-02-22 21:23:37.000000000 +0100 +++ new/terragrunt-0.44.1/test/integration_test.go 2023-02-28 15:23:02.000000000 +0100 @@ -138,6 +138,7 @@ TEST_FIXTURE_TFLINT_NO_CONFIG_FILE = "fixture-tflint/no-config-file" TEST_FIXTURE_TFLINT_MODULE_FOUND = "fixture-tflint/module-found" TEST_FIXTURE_TFLINT_NO_TF_SOURCE_PATH = "fixture-tflint/no-tf-source" + TEST_FIXTURE_PARALLEL_RUN = "fixture-parallel-run" TERRAFORM_BINARY = "terraform" TERRAFORM_FOLDER = ".terraform" TERRAFORM_STATE = "terraform.tfstate" @@ -5224,7 +5225,6 @@ err = runTerragruntCommand(t, fmt.Sprintf("terragrunt apply --terragrunt-log-level debug --terragrunt-non-interactive -auto-approve --terragrunt-working-dir %s", shallowPath), &stdout, &stderr) logBufferContentsLineByLine(t, stdout, "shallow-map-executed") require.NoError(t, err) - } func validateBoolOutput(t *testing.T, outputs map[string]TerraformOutput, key string, value bool) { @@ -5233,57 +5233,3 @@ require.Truef(t, hasPlatform, "Expected output %s to be defined", key) require.Equalf(t, output.Value, value, "Expected output %s to be %t", key, value) } - -func TestTflintFindsNoIssuesWithValidCode(t *testing.T) { - out := new(bytes.Buffer) - errOut := new(bytes.Buffer) - rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_ISSUES_FOUND) - modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_ISSUES_FOUND) - err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-log-level debug --terragrunt-working-dir %s", modulePath), out, errOut) - assert.NoError(t, err) - - assert.NotContains(t, errOut.String(), "Error while running tflint with args:") - assert.NotContains(t, errOut.String(), "Tflint found issues in the project. Check for the tflint logs above.") - - assert.Contains(t, errOut.String(), fmt.Sprintf("--config %s/.tflint.hcl", modulePath)) -} - -func TestTflintFindsModule(t *testing.T) { - out := new(bytes.Buffer) - errOut := new(bytes.Buffer) - rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_MODULE_FOUND) - modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_MODULE_FOUND) - err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), out, errOut) - assert.NoError(t, err) - - assert.NotContains(t, errOut.String(), "Error while running tflint with args:") - assert.NotContains(t, errOut.String(), "Tflint found issues in the project. Check for the tflint logs above.") -} - -func TestTflintFindsIssuesWithInvalidInput(t *testing.T) { - errOut := new(bytes.Buffer) - rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_ISSUES_FOUND) - modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_ISSUES_FOUND) - err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), os.Stdout, errOut) - assert.Error(t, err, "Tflint found issues in the project. Check for the tflint logs") -} - -func TestTflintWithoutConfigFile(t *testing.T) { - errOut := new(bytes.Buffer) - rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_CONFIG_FILE) - modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_CONFIG_FILE) - err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), io.Discard, errOut) - assert.Error(t, err, "Could not find .tflint.hcl config file in the parent folders:") -} - -func TestTflintFindsConfigInCurrentPath(t *testing.T) { - out := new(bytes.Buffer) - errOut := new(bytes.Buffer) - rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_TF_SOURCE_PATH) - modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_TF_SOURCE_PATH) - err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-log-level debug --terragrunt-working-dir %s", modulePath), out, errOut) - assert.NoError(t, err) - - assert.Contains(t, errOut.String(), "Tflint has run successfully. No issues found") - assert.Contains(t, errOut.String(), fmt.Sprintf("--config %s/.tflint.hcl", modulePath)) -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.44.0/test/integration_tflint_test.go new/terragrunt-0.44.1/test/integration_tflint_test.go --- old/terragrunt-0.44.0/test/integration_tflint_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/terragrunt-0.44.1/test/integration_tflint_test.go 2023-02-28 15:23:02.000000000 +0100 @@ -0,0 +1,86 @@ +//go:build tflint +// +build tflint + +package test + +import ( + "bytes" + "fmt" + "io" + "os" + "testing" + + "github.com/gruntwork-io/terragrunt/util" + "github.com/stretchr/testify/assert" +) + +func TestTflintFindsNoIssuesWithValidCode(t *testing.T) { + out := new(bytes.Buffer) + errOut := new(bytes.Buffer) + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_ISSUES_FOUND) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_ISSUES_FOUND) + err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-log-level debug --terragrunt-working-dir %s", modulePath), out, errOut) + assert.NoError(t, err) + + assert.NotContains(t, errOut.String(), "Error while running tflint with args:") + assert.NotContains(t, errOut.String(), "Tflint found issues in the project. Check for the tflint logs above.") + + assert.Contains(t, errOut.String(), fmt.Sprintf("--config %s/.tflint.hcl", modulePath)) +} + +func TestTflintFindsModule(t *testing.T) { + out := new(bytes.Buffer) + errOut := new(bytes.Buffer) + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_MODULE_FOUND) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_MODULE_FOUND) + err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), out, errOut) + assert.NoError(t, err) + + assert.NotContains(t, errOut.String(), "Error while running tflint with args:") + assert.NotContains(t, errOut.String(), "Tflint found issues in the project. Check for the tflint logs above.") +} + +func TestTflintFindsIssuesWithInvalidInput(t *testing.T) { + errOut := new(bytes.Buffer) + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_ISSUES_FOUND) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_ISSUES_FOUND) + err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), os.Stdout, errOut) + assert.Error(t, err, "Tflint found issues in the project. Check for the tflint logs") +} + +func TestTflintWithoutConfigFile(t *testing.T) { + errOut := new(bytes.Buffer) + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_CONFIG_FILE) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_CONFIG_FILE) + err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-working-dir %s", modulePath), io.Discard, errOut) + assert.Error(t, err, "Could not find .tflint.hcl config file in the parent folders:") +} + +func TestTflintFindsConfigInCurrentPath(t *testing.T) { + out := new(bytes.Buffer) + errOut := new(bytes.Buffer) + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_TFLINT_NO_TF_SOURCE_PATH) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_TFLINT_NO_TF_SOURCE_PATH) + err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan --terragrunt-log-level debug --terragrunt-working-dir %s", modulePath), out, errOut) + assert.NoError(t, err) + + assert.Contains(t, errOut.String(), "Tflint has run successfully. No issues found") + assert.Contains(t, errOut.String(), fmt.Sprintf("--config %s/.tflint.hcl", modulePath)) +} + +func TestTflintInitSameModule(t *testing.T) { + rootPath := copyEnvironmentWithTflint(t, TEST_FIXTURE_PARALLEL_RUN) + t.Cleanup(func() { + removeFolder(t, rootPath) + }) + modulePath := util.JoinPath(rootPath, TEST_FIXTURE_PARALLEL_RUN) + runPath := util.JoinPath(rootPath, TEST_FIXTURE_PARALLEL_RUN, "dev") + appTemplate := util.JoinPath(rootPath, TEST_FIXTURE_PARALLEL_RUN, "dev", "app") + // generate multiple "app" modules that will be initialized in parallel + for i := 0; i < 50; i++ { + appPath := util.JoinPath(modulePath, "dev", fmt.Sprintf("app-%d", i)) + err := util.CopyFolderContents(appTemplate, appPath, ".terragrunt-test", []string{}) + assert.NoError(t, err) + } + runTerragrunt(t, fmt.Sprintf("terragrunt run-all init --terragrunt-log-level debug --terragrunt-non-interactive --terragrunt-working-dir %s", runPath)) +} ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz /work/SRC/openSUSE:Factory/.terragrunt.new.31432/vendor.tar.gz differ: char 5, line 1