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-06-13 16:10:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/terragrunt (Old)
 and      /work/SRC/openSUSE:Factory/.terragrunt.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "terragrunt"

Tue Jun 13 16:10:36 2023 rev:52 rq:1092767 version:0.46.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes    2023-06-11 
19:57:59.048138030 +0200
+++ /work/SRC/openSUSE:Factory/.terragrunt.new.15902/terragrunt.changes 
2023-06-13 16:10:38.659286902 +0200
@@ -1,0 +2,13 @@
+Mon Jun 12 20:00:20 UTC 2023 - ka...@b1-systems.de
+
+- Update to version 0.46.3:
+  * #2595 Fix for fetching reference value with slashes (#2597)
+
+-------------------------------------------------------------------
+Mon Jun 12 19:57:44 UTC 2023 - ka...@b1-systems.de
+
+- Update to version 0.46.2:
+  * feat: support git tag in `--terragrunt-source-map` option
+    (#2586)
+
+-------------------------------------------------------------------

Old:
----
  terragrunt-0.46.1.obscpio

New:
----
  terragrunt-0.46.3.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ terragrunt.spec ++++++
--- /var/tmp/diff_new_pack.aztOYw/_old  2023-06-13 16:10:39.727293202 +0200
+++ /var/tmp/diff_new_pack.aztOYw/_new  2023-06-13 16:10:39.735293250 +0200
@@ -19,7 +19,7 @@
 %define __arch_install_post export NO_BRP_STRIP_DEBUG=true
 
 Name:           terragrunt
-Version:        0.46.1
+Version:        0.46.3
 Release:        0
 Summary:        Thin wrapper for Terraform for working with multiple Terraform 
modules
 License:        MIT

++++++ _service ++++++
--- /var/tmp/diff_new_pack.aztOYw/_old  2023-06-13 16:10:39.771293462 +0200
+++ /var/tmp/diff_new_pack.aztOYw/_new  2023-06-13 16:10:39.775293486 +0200
@@ -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.46.1</param>
+    <param name="revision">v0.46.3</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.aztOYw/_old  2023-06-13 16:10:39.799293627 +0200
+++ /var/tmp/diff_new_pack.aztOYw/_new  2023-06-13 16:10:39.799293627 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/gruntwork-io/terragrunt</param>
-              <param 
name="changesrevision">e190fa3d9a0a92c32fd5d031851775a702179db7</param></service></servicedata>
+              <param 
name="changesrevision">d59c964f36a32f2b73217e6306b07056cd473054</param></service></servicedata>
 (No newline at EOF)
 

++++++ terragrunt-0.46.1.obscpio -> terragrunt-0.46.3.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/cli/args.go 
new/terragrunt-0.46.3/cli/args.go
--- old/terragrunt-0.46.1/cli/args.go   2023-06-01 20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/cli/args.go   2023-06-07 21:09:12.000000000 +0200
@@ -497,7 +497,7 @@
        if asList == nil {
                return defaultValue, nil
        }
-       return util.KeyValuePairStringListToMap(asList)
+       return util.KeyValuePairStringListToMap(asList, util.SplitUrls)
 }
 
 // Parses an environment variable that is encoded as a comma separated kv pair 
(e.g.,
@@ -509,7 +509,7 @@
                return map[string]string{}, nil
        }
        mappingsAsList := strings.Split(rawEnvVarVal, ",")
-       return util.KeyValuePairStringListToMap(mappingsAsList)
+       return util.KeyValuePairStringListToMap(mappingsAsList, util.SplitUrls)
 }
 
 // Convert the given variables to a map of environment variables that will 
expose those variables to Terraform. The
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/cli/download_source.go 
new/terragrunt-0.46.3/cli/download_source.go
--- old/terragrunt-0.46.1/cli/download_source.go        2023-06-01 
20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/cli/download_source.go        2023-06-07 
21:09:12.000000000 +0200
@@ -175,9 +175,10 @@
 }
 
 // updateGetters returns the customized go-getter interfaces that Terragrunt 
relies on. Specifically:
-// - Local file path getter is updated to copy the files instead of creating 
symlinks, which is what go-getter defaults
-//   to.
-// - Include the customized getter for fetching sources from the Terraform 
Registry.
+//   - Local file path getter is updated to copy the files instead of creating 
symlinks, which is what go-getter defaults
+//     to.
+//   - Include the customized getter for fetching sources from the Terraform 
Registry.
+//
 // This creates a closure that returns a function so that we have access to 
the terragrunt configuration, which is
 // necessary for customizing the behavior of the file getter.
 func updateGetters(terragruntConfig *config.TerragruntConfig) 
func(*getter.Client) error {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/cli/tfsource/types.go 
new/terragrunt-0.46.3/cli/tfsource/types.go
--- old/terragrunt-0.46.1/cli/tfsource/types.go 2023-06-01 20:15:40.000000000 
+0200
+++ new/terragrunt-0.46.3/cli/tfsource/types.go 2023-06-07 21:09:12.000000000 
+0200
@@ -111,25 +111,25 @@
 // To maximize reuse, given a working directory w and a source URL s, we 
download code from S into the folder /T/W/H
 // where:
 //
-// 1. S is the part of s before the double-slash (//). This typically 
represents the root of the repo (e.g.
-//    github.com/foo/infrastructure-modules). We download the entire repo so 
that relative paths to other files in that
-//    repo resolve correctly. If no double-slash is specified, all of s is 
used.
-// 1. T is the OS temp dir (e.g. /tmp).
-// 2. W is the base 64 encoded sha1 hash of w. This ensures that if you are 
running Terragrunt concurrently in
-//    multiple folders (e.g. during automated tests), then even if those 
folders are using the same source URL s, they
-//    do not overwrite each other.
-// 3. H is the base 64 encoded sha1 of S without its query string. For remote 
source URLs (e.g. Git
-//    URLs), this is based on the assumption that the scheme/host/path of the 
URL (e.g. git::github.com/foo/bar)
-//    identifies the repo, and we always want to download the same repo into 
the same folder (see the encodeSourceName
-//    method). We also assume the version of the module is stored in the query 
string (e.g. ref=v0.0.3), so we store
-//    the base 64 encoded sha1 of the query string in a file called 
.terragrunt-source-version within /T/W/H.
+//  1. S is the part of s before the double-slash (//). This typically 
represents the root of the repo (e.g.
+//     github.com/foo/infrastructure-modules). We download the entire repo so 
that relative paths to other files in that
+//     repo resolve correctly. If no double-slash is specified, all of s is 
used.
+//  1. T is the OS temp dir (e.g. /tmp).
+//  2. W is the base 64 encoded sha1 hash of w. This ensures that if you are 
running Terragrunt concurrently in
+//     multiple folders (e.g. during automated tests), then even if those 
folders are using the same source URL s, they
+//     do not overwrite each other.
+//  3. H is the base 64 encoded sha1 of S without its query string. For remote 
source URLs (e.g. Git
+//     URLs), this is based on the assumption that the scheme/host/path of the 
URL (e.g. git::github.com/foo/bar)
+//     identifies the repo, and we always want to download the same repo into 
the same folder (see the encodeSourceName
+//     method). We also assume the version of the module is stored in the 
query string (e.g. ref=v0.0.3), so we store
+//     the base 64 encoded sha1 of the query string in a file called 
.terragrunt-source-version within /T/W/H.
 //
 // The downloadTerraformSourceIfNecessary decides when we should download the 
Terraform code and when not to. It uses
 // the following rules:
 //
-// 1. Always download source URLs pointing to local file paths.
-// 2. Only download source URLs pointing to remote paths if /T/W/H doesn't 
already exist or, if it does exist, if the
-//    version number in /T/W/H/.terragrunt-source-version doesn't match the 
current version.
+//  1. Always download source URLs pointing to local file paths.
+//  2. Only download source URLs pointing to remote paths if /T/W/H doesn't 
already exist or, if it does exist, if the
+//     version number in /T/W/H/.terragrunt-source-version doesn't match the 
current version.
 func NewTerraformSource(source string, downloadDir string, workingDir string, 
logger *logrus.Entry) (*TerraformSource, error) {
 
        canonicalWorkingDir, err := util.CanonicalPath(workingDir, "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/cli/tfsource/types_test.go 
new/terragrunt-0.46.3/cli/tfsource/types_test.go
--- old/terragrunt-0.46.1/cli/tfsource/types_test.go    2023-06-01 
20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/cli/tfsource/types_test.go    2023-06-07 
21:09:12.000000000 +0200
@@ -36,6 +36,7 @@
                {"parent-url-multiple-children-no-double-slash", 
"ssh://g...@github.com/foo/modules.git/foo/bar/baz/blah", 
"ssh://g...@github.com/foo/modules.git/foo/bar/baz/blah", ""},
                {"parent-url-one-child-with-double-slash", 
"ssh://g...@github.com/foo/modules.git//foo", 
"ssh://g...@github.com/foo/modules.git", "foo"},
                {"parent-url-multiple-children-with-double-slash", 
"ssh://g...@github.com/foo/modules.git//foo/bar/baz/blah", 
"ssh://g...@github.com/foo/modules.git", "foo/bar/baz/blah"},
+               {"separate-ref-with-slash", 
"ssh://g...@github.com/foo/modules.git//foo?ref=feature/modules", 
"ssh://g...@github.com/foo/modules.git?ref=feature/modules", "foo"},
        }
 
        for _, testCase := range testCases {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/terragrunt-0.46.1/test/fixture-download/remote-ref/terragrunt.hcl 
new/terragrunt-0.46.3/test/fixture-download/remote-ref/terragrunt.hcl
--- old/terragrunt-0.46.1/test/fixture-download/remote-ref/terragrunt.hcl       
1970-01-01 01:00:00.000000000 +0100
+++ new/terragrunt-0.46.3/test/fixture-download/remote-ref/terragrunt.hcl       
2023-06-07 21:09:12.000000000 +0200
@@ -0,0 +1,7 @@
+inputs = {
+  name = "World"
+}
+
+terraform {
+  source = 
"git::g...@github.com:gruntwork-io/terragrunt.git//test/fixture-download/hello-world?ref=fixture/test"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/terragrunt-0.46.1/test/fixture-source-map/slashes-in-ref/terragrunt.hcl 
new/terragrunt-0.46.3/test/fixture-source-map/slashes-in-ref/terragrunt.hcl
--- old/terragrunt-0.46.1/test/fixture-source-map/slashes-in-ref/terragrunt.hcl 
1970-01-01 01:00:00.000000000 +0100
+++ new/terragrunt-0.46.3/test/fixture-source-map/slashes-in-ref/terragrunt.hcl 
2023-06-07 21:09:12.000000000 +0200
@@ -0,0 +1,7 @@
+terraform {
+  source = 
"git::ssh://g...@github.com/gruntwork-io/i-dont-exist.git//test/fixture-download/hello-world"
+}
+
+inputs = {
+  name = "terragrunt"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/test/integration_test.go 
new/terragrunt-0.46.3/test/integration_test.go
--- old/terragrunt-0.46.1/test/integration_test.go      2023-06-01 
20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/test/integration_test.go      2023-06-07 
21:09:12.000000000 +0200
@@ -148,6 +148,8 @@
        TEST_FIXTURE_MODULE_PATH_ERROR                                          
 = "fixture-module-path-in-error"
        TEST_FIXTURE_HCLFMT_DIFF                                                
 = "fixture-hclfmt-diff"
        TEST_FIXTURE_DESTROY_DEPENDENT_MODULE                                   
 = "fixture-destroy-dependent-module"
+       TEST_FIXTURE_REF_SOURCE                                                 
 = "fixture-download/remote-ref"
+       TEST_FIXTURE_SOURCE_MAP_SLASHES                                         
 = "fixture-source-map/slashes-in-ref"
        TERRAFORM_BINARY                                                        
 = "terraform"
        TERRAFORM_FOLDER                                                        
 = ".terraform"
        TERRAFORM_STATE                                                         
 = "terraform.tfstate"
@@ -5528,6 +5530,34 @@
        assert.True(t, strings.Contains(stderr.String(), "\"value\": 
\"module-a.txt\""))
 }
 
+func TestDownloadSourceWithRef(t *testing.T) {
+       t.Parallel()
+
+       tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_REF_SOURCE)
+       cleanupTerraformFolder(t, tmpEnvPath)
+       testPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_REF_SOURCE)
+
+       stdout := bytes.Buffer{}
+       stderr := bytes.Buffer{}
+
+       err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan 
--terragrunt-non-interactive --terragrunt-working-dir %s", testPath), &stdout, 
&stderr)
+       require.NoError(t, err)
+}
+
+func TestSourceMapWithSlashInRef(t *testing.T) {
+       t.Parallel()
+
+       tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_SOURCE_MAP_SLASHES)
+       cleanupTerraformFolder(t, tmpEnvPath)
+       testPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_SOURCE_MAP_SLASHES)
+
+       stdout := bytes.Buffer{}
+       stderr := bytes.Buffer{}
+
+       err := runTerragruntCommand(t, fmt.Sprintf("terragrunt plan 
--terragrunt-non-interactive --terragrunt-source-map 
git::ssh://g...@github.com/gruntwork-io/i-dont-exist.git=git::g...@github.com:gruntwork-io/terragrunt.git?ref=fixture/test
 --terragrunt-working-dir %s", testPath), &stdout, &stderr)
+       require.NoError(t, err)
+}
+
 func validateOutput(t *testing.T, outputs map[string]TerraformOutput, key 
string, value interface{}) {
        t.Helper()
        output, hasPlatform := outputs[key]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/util/collections.go 
new/terragrunt-0.46.3/util/collections.go
--- old/terragrunt-0.46.1/util/collections.go   2023-06-01 20:15:40.000000000 
+0200
+++ new/terragrunt-0.46.3/util/collections.go   2023-06-07 21:09:12.000000000 
+0200
@@ -169,11 +169,14 @@
        return append(list[:index], tail...)
 }
 
-// KeyValuePairListToMap converts a list of key value pair encoded as 
`key=value` strings into a map.
-func KeyValuePairStringListToMap(asList []string) (map[string]string, error) {
+// KeyValuePairListToMap converts a list of key value pair encoded as 
`key=value` strings into a map
+// using the given `splitter` callback func, which can be the `strings.Split` 
function.
+func KeyValuePairStringListToMap(asList []string, splitter func(s, sep string) 
[]string) (map[string]string, error) {
        asMap := map[string]string{}
+
        for _, arg := range asList {
-               parts := strings.Split(arg, "=")
+               parts := splitter(arg, "=")
+
                if len(parts) != 2 {
                        return nil, errors.WithStackTrace(InvalidKeyValue(arg))
                }
@@ -187,6 +190,31 @@
        return asMap, nil
 }
 
+// SplitUrls slices s into all substrings separated by sep and returns a slice 
of
+// the substrings between those separators.
+// Taking into account that the `=` sign can also be used as a git tag, e.g. 
`g...@github.com/test.git?ref=feature`
+func SplitUrls(s, sep string) []string {
+       masks := map[string]string{
+               "?ref=": "<ref-place-holder>",
+       }
+
+       // mask
+       for src, mask := range masks {
+               s = strings.Replace(s, src, mask, -1)
+       }
+
+       urls := strings.Split(s, sep)
+
+       // unmask
+       for i := range urls {
+               for src, mask := range masks {
+                       urls[i] = strings.Replace(urls[i], mask, src, -1)
+               }
+       }
+
+       return urls
+}
+
 // custom error types
 
 type InvalidKeyValue string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/util/collections_test.go 
new/terragrunt-0.46.3/util/collections_test.go
--- old/terragrunt-0.46.1/util/collections_test.go      2023-06-01 
20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/util/collections_test.go      2023-06-07 
21:09:12.000000000 +0200
@@ -240,13 +240,15 @@
        t.Parallel()
 
        testCases := []struct {
-               name   string
-               input  []string
-               output map[string]string
+               name     string
+               input    []string
+               splitter func(s, sep string) []string
+               output   map[string]string
        }{
                {
                        "base",
                        []string{"foo=bar", "baz=carol"},
+                       SplitUrls,
                        map[string]string{
                                "foo": "bar",
                                "baz": "carol",
@@ -255,18 +257,26 @@
                {
                        "special_chars",
                        []string{"ssh://g...@github.com=/path/to/local"},
+                       SplitUrls,
                        map[string]string{"ssh://g...@github.com": 
"/path/to/local"},
                },
                {
+                       "with_tags",
+                       
[]string{"ssh://g...@github.com=ssh://g...@github.com/test.git?ref=feature"},
+                       SplitUrls,
+                       map[string]string{"ssh://g...@github.com": 
"ssh://g...@github.com/test.git?ref=feature"},
+               },
+               {
                        "empty",
                        []string{},
+                       SplitUrls,
                        map[string]string{},
                },
        }
 
        for _, testCase := range testCases {
                t.Run(testCase.name, func(t *testing.T) {
-                       actualOutput, err := 
KeyValuePairStringListToMap(testCase.input)
+                       actualOutput, err := 
KeyValuePairStringListToMap(testCase.input, testCase.splitter)
                        assert.NoError(t, err)
                        assert.Equal(
                                t,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/util/file.go 
new/terragrunt-0.46.3/util/file.go
--- old/terragrunt-0.46.1/util/file.go  2023-06-01 20:15:40.000000000 +0200
+++ new/terragrunt-0.46.3/util/file.go  2023-06-07 21:09:12.000000000 +0200
@@ -9,6 +9,8 @@
        "regexp"
        "strings"
 
+       urlhelper "github.com/hashicorp/go-getter/helper/url"
+
        "fmt"
 
        "github.com/gruntwork-io/terragrunt/errors"
@@ -390,6 +392,20 @@
 func JoinTerraformModulePath(modulesFolder string, path string) string {
        cleanModulesFolder := strings.TrimRight(modulesFolder, `/\`)
        cleanPath := strings.TrimLeft(path, `/\`)
+       // if source path contains "?ref=", reconstruct module dir using "//"
+       if strings.Contains(cleanModulesFolder, "?ref=") && cleanPath != "" {
+               canonicalSourceUrl, err := urlhelper.Parse(cleanModulesFolder)
+               if err == nil {
+                       // append path
+                       if canonicalSourceUrl.Opaque != "" {
+                               canonicalSourceUrl.Opaque = 
fmt.Sprintf("%s//%s", strings.TrimRight(canonicalSourceUrl.Opaque, `/\`), 
cleanPath)
+                       } else {
+                               canonicalSourceUrl.Path = fmt.Sprintf("%s//%s", 
strings.TrimRight(canonicalSourceUrl.Path, `/\`), cleanPath)
+                       }
+                       return canonicalSourceUrl.String()
+               }
+               // fallback to old behavior if we can't parse the url
+       }
        return fmt.Sprintf("%s//%s", cleanModulesFolder, cleanPath)
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.46.1/util/file_test.go 
new/terragrunt-0.46.3/util/file_test.go
--- old/terragrunt-0.46.1/util/file_test.go     2023-06-01 20:15:40.000000000 
+0200
+++ new/terragrunt-0.46.3/util/file_test.go     2023-06-07 21:09:12.000000000 
+0200
@@ -115,6 +115,12 @@
                {"foo//", "//bar", "foo//bar"},
                {"/foo/bar/baz", "/a/b/c", "/foo/bar/baz//a/b/c"},
                {"/foo/bar/baz/", "//a/b/c", "/foo/bar/baz//a/b/c"},
+               {"/foo?ref=feature/1", "bar", "/foo//bar?ref=feature/1"},
+               {"/foo?ref=feature/1", "/bar", "/foo//bar?ref=feature/1"},
+               {"/foo//?ref=feature/1", "/bar", "/foo//bar?ref=feature/1"},
+               {"/foo//?ref=feature/1", "//bar", "/foo//bar?ref=feature/1"},
+               {"/foo/bar/baz?ref=feature/1", "/a/b/c", 
"/foo/bar/baz//a/b/c?ref=feature/1"},
+               {"/foo/bar/baz/?ref=feature/1", "//a/b/c", 
"/foo/bar/baz//a/b/c?ref=feature/1"},
        }
 
        for _, testCase := range testCases {

++++++ terragrunt.obsinfo ++++++
--- /var/tmp/diff_new_pack.aztOYw/_old  2023-06-13 16:10:40.579298229 +0200
+++ /var/tmp/diff_new_pack.aztOYw/_new  2023-06-13 16:10:40.583298252 +0200
@@ -1,5 +1,5 @@
 name: terragrunt
-version: 0.46.1
-mtime: 1685643340
-commit: e190fa3d9a0a92c32fd5d031851775a702179db7
+version: 0.46.3
+mtime: 1686164952
+commit: d59c964f36a32f2b73217e6306b07056cd473054
 

++++++ vendor.tar.gz ++++++
/work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz 
/work/SRC/openSUSE:Factory/.terragrunt.new.15902/vendor.tar.gz differ: char 5, 
line 1

Reply via email to