Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log searched assets #159

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/apimsg/apimsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ package apimsg
import "errors"

const (
AssetsName = "assets"
MsgFetchAllReleases = "Fetching all releases information from "
MsgFetchRelease = "Fetching release information from "
MsgSearch = "Search"
)

var (
Expand Down
5 changes: 5 additions & 0 deletions versionmanager/retriever/atmos/atmosretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"runtime"
"strings"

"github.com/hashicorp/go-hclog"
"github.com/tofuutils/tenv/config"
"github.com/tofuutils/tenv/pkg/apimsg"
sha256check "github.com/tofuutils/tenv/pkg/check/sha256"
Expand Down Expand Up @@ -63,6 +64,10 @@ func (r AtmosRetriever) InstallRelease(versionStr string, targetPath string) err

var assetURLs []string
fileName, shaFileName := buildAssetNames(versionStr, r.conf.Arch)
if r.conf.Displayer.IsDebug() {
r.conf.Displayer.Log(hclog.Debug, apimsg.MsgSearch, apimsg.AssetsName, []string{fileName, shaFileName})
}

switch r.conf.Atmos.GetInstallMode() {
case config.InstallModeDirect:
baseAssetURL, err2 := url.JoinPath(r.conf.Atmos.GetRemoteURL(), cloudposseName, config.AtmosName, github.Releases, github.Download, tag) //nolint
Expand Down
9 changes: 9 additions & 0 deletions versionmanager/retriever/terraform/terraformretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"runtime"
"strings"

"github.com/hashicorp/go-hclog"
"github.com/tofuutils/tenv/config"
"github.com/tofuutils/tenv/pkg/apimsg"
pgpcheck "github.com/tofuutils/tenv/pkg/check/pgp"
Expand Down Expand Up @@ -71,6 +72,10 @@ func (r TerraformRetriever) InstallRelease(version string, targetPath string) er
switch r.conf.Tf.GetInstallMode() {
case config.InstallModeDirect:
fileName, shaFileName, shaSigFileName = buildAssetNames(version, r.conf.Arch)
if r.conf.Displayer.IsDebug() {
r.conf.Displayer.Log(hclog.Debug, apimsg.MsgSearch, apimsg.AssetsName, []string{fileName, shaFileName, shaSigFileName})
}

assetURLs, err := htmlretriever.BuildAssetURLs(baseVersionURL, fileName, shaFileName, shaSigFileName)
if err != nil {
return err
Expand All @@ -95,6 +100,10 @@ func (r TerraformRetriever) InstallRelease(version string, targetPath string) er
return err
}

if r.conf.Displayer.IsDebug() {
r.conf.Displayer.Log(hclog.Debug, apimsg.MsgSearch, apimsg.AssetsName, []string{fileName, shaFileName, shaSigFileName})
}

assetURLs, err := htmlretriever.BuildAssetURLs(baseVersionURL, shaFileName, shaSigFileName)
if err != nil {
return err
Expand Down
5 changes: 5 additions & 0 deletions versionmanager/retriever/terragrunt/terragruntretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"runtime"
"strings"

"github.com/hashicorp/go-hclog"
"github.com/tofuutils/tenv/config"
"github.com/tofuutils/tenv/pkg/apimsg"
sha256check "github.com/tofuutils/tenv/pkg/check/sha256"
Expand Down Expand Up @@ -60,6 +61,10 @@ func (r TerragruntRetriever) InstallRelease(versionStr string, targetPath string

var assetURLs []string
fileName, shaFileName := buildAssetNames(r.conf.Arch)
if r.conf.Displayer.IsDebug() {
r.conf.Displayer.Log(hclog.Debug, apimsg.MsgSearch, apimsg.AssetsName, []string{fileName, shaFileName})
}

switch r.conf.Tg.GetInstallMode() {
case config.InstallModeDirect:
baseAssetURL, err2 := url.JoinPath(r.conf.Tg.GetRemoteURL(), gruntworkName, config.TerragruntName, github.Releases, github.Download, tag) //nolint
Expand Down
5 changes: 5 additions & 0 deletions versionmanager/retriever/tofu/tofuretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"runtime"
"strings"

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-version"
"github.com/tofuutils/tenv/config"
"github.com/tofuutils/tenv/pkg/apimsg"
Expand Down Expand Up @@ -76,6 +77,10 @@ func (r TofuRetriever) InstallRelease(versionStr string, targetPath string) erro

var assetURLs []string
assetNames := buildAssetNames(versionStr, r.conf.Arch, stable)
if r.conf.Displayer.IsDebug() {
r.conf.Displayer.Log(hclog.Debug, apimsg.MsgSearch, apimsg.AssetsName, assetNames)
}

switch r.conf.Tofu.GetInstallMode() {
case config.InstallModeDirect:
baseAssetURL, err2 := url.JoinPath(r.conf.Tofu.GetRemoteURL(), opentofu, opentofu, github.Releases, github.Download, tag) //nolint
Expand Down
Loading