Documentation
¶
Index ¶
Constants ¶
const ( VersionAPIEndpoint = "https://api.github.com/repos/openshift/ocm-container/releases/latest" VersionAddressTemplate = "https://github.com/openshift/ocm-container/releases/download/v%s/ocm-container_%s_%s_%s.tar.gz" // version, version, GOOS, GOARCH )
Variables ¶
var ( // GitCommit is the short git commit hash from the environment // Will be set during build process via GoReleaser // See also: https://pkg.go.dev/cmd/link GitCommit string // Version is the tag version from the environment // Will be set during build process via GoReleaser // See also: https://pkg.go.dev/cmd/link Version string = "v0.0.0-unknown" )
Functions ¶
func GetLatestVersion ¶
getLatestVersion connects to the GitHub API and returns the latest ocm-container tag name
func GetOcmContainerComponent ¶ added in v1.0.1
func GetOcmContainerComponent() string
GetOcmContainerComponent returns the component variant of the ocm-container image if running inside one, or an empty string if not running in ocm-container.
Possible return values:
- "micro": ocm-container-micro variant (minimal tools: ocm, ocm-backplane, oc)
- "minimal": ocm-container-minimal variant (adds AWS CLI, rosa, osdctl, yq)
- "full": ocm-container variant (full toolset including omc, jira-cli, oc-nodepp, vault, and more)
- "": not running in ocm-container
Example usage:
component := utils.GetOcmContainerComponent()
if component != "" {
fmt.Printf("Running in ocm-container-%s\n", component)
}
func IsRunningInOcmContainer ¶ added in v1.0.1
func IsRunningInOcmContainer() bool
IsRunningInOcmContainer returns true if the current process is running inside an ocm-container environment. This is determined by checking the IO_OPENSHIFT_MANAGED_NAME environment variable.
This function can be imported by other Go programs (such as osdctl) to detect when they are running inside ocm-container and adjust their behavior accordingly (e.g., skipping browser auto-launch, adjusting network binding addresses).
Example usage:
import "github.com/openshift/ocm-container/pkg/utils"
if utils.IsRunningInOcmContainer() {
// Skip browser launch, show URL instead
fmt.Println("Running in container - open URL in your host browser")
} else {
// Normal behavior
openBrowser(url)
}
Types ¶
This section is empty.