Skip to content

Commit

Permalink
Merge pull request #21 from Darth-Tech/bugfix/duplicate_module_omission
Browse files Browse the repository at this point in the history
Bugfix - Modules with same repo but different versions are logged separately in report
  • Loading branch information
thundersparkf authored Aug 30, 2024
2 parents 40ac399 + d3ef21b commit 6cbb165
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/checkForUpdates.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var checkForUpdatesCmd = &cobra.Command{
Use: "checkForUpdates --path=[Directory with module usage]",
Short: "search for updates for terraform modules using in your code and generate a report",
Long: `
Searches (sub)directories for module sources and versions to create a report listing versions available for updates.
CSV format : repo_link | current_version | updates_available
Expand Down Expand Up @@ -97,7 +97,8 @@ func checkForModuleSourceUpdates(path string, latestVersion bool) ([]map[string]
for _, module := range modules {
err := bar.Add(1)
Check(err, "progressbar error")
if !slices.Contains(listWritten, module["repo"]) {
moduleUsed := module["repo"] + ":" + module["current_version"]
if !slices.Contains(listWritten, moduleUsed) {
_, tagsList, err := processGitRepo(module["repo"], module["current_version"])
if err != nil {
failureList = append(failureList, map[string]string{
Expand All @@ -114,7 +115,7 @@ func checkForModuleSourceUpdates(path string, latestVersion bool) ([]map[string]
module["updates_available"] = tagsList

}
listWritten = append(listWritten, module["repo"])
listWritten = append(listWritten, moduleUsed)
}
slog.Debug("checkForUpdates :: checkForModuleSourceUpdates :: path :: ", "repo", module["repo"], "current", module["current_version"], "updates_available", module["updates_available"], "latest_update", module["latest_update"])

Expand Down

0 comments on commit 6cbb165

Please sign in to comment.