Files
steampipe/pkg/plugin/update.go
kaidaguerre 40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00

44 lines
1.3 KiB
Go

package plugin
import (
"runtime"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/ociinstaller"
)
// SkipUpdate determines if the latest version in a "stream"
// requires the plugin to update.
func SkipUpdate(report VersionCheckReport) (bool, string) {
// 1) If there is an updated version ALWAYS update
if report.Plugin.ImageDigest != report.CheckResponse.Digest {
return false, ""
}
// 2) If we are M1, current installed version is AMD, and ARM is available - update
if isRunningAsMacM1() && manifestHasM1Binary(report.CheckResponse.Manifest) && report.Plugin.BinaryArchitecture != constants.ArchARM64 {
return false, ""
}
// 3) Otherwise skip
return true, constants.InstallMessagePluginLatestAlreadyInstalled
}
// check to see if steampipe is running as a Mac/M1 build
// Mac/M1 can run 'amd64' builds, but that is not a
// problem, since they will be running under 'rosetta'
// TODO: Find a way to determine the underlying architecture, rather than depending on Go runtime
func isRunningAsMacM1() bool {
return runtime.GOOS == constants.OSDarwin && runtime.GOARCH == constants.ArchARM64
}
func manifestHasM1Binary(manifest responseManifest) bool {
for _, rml := range manifest.Layers {
if rml.MediaType == ociinstaller.MediaTypePluginDarwinArm64Layer {
return true
}
}
return false
}