Expand description
Tool preflight (C3).
Cross-cutting preflight checks for external tools an env-pack handler needs
to do real work (e.g. terraform/kubectl/helm/docker/aws/gcloud/
az). The Phase A surface ships:
ToolCheck/ToolCheckOutcome— the result shape every check returns, with structuredMissing/VersionMismatch/AuthFailed/Unreachable/ProbeErrorvariants and an honestinstall_hint.- Generic primitives:
check_binary_presentandcheck_version_probe— handlers compose these into per-tool checks. - A named-tool catalog (
terraform,tofu,kubectl,helm,docker,podman,aws,gcloud,az) with minimum-version defaults the catalog tracks and honest install-hint text. - Auth/scope probes (
aws_caller_identity,gcloud_auth_list,az_account_show,kubectl_can_i) that go beyond binary presence to verify credentials and required permissions.
Phase A handlers (local-process, dev-store, stdout, in-memory) are
all in-process and return an empty preflight via the default
crate::env_packs::EnvPackHandler::preflight. Phase D handlers (K8s,
cloud) compose this catalog by name.
gtc op env tool-check <env_id> aggregates per-binding ToolChecks into
a structured JSON outcome.
No timeout discipline is enforced here — built-in Phase A handlers don’t
shell out, so a hanging probe can’t surface yet. Phase D plumbing should
wrap the slow primitives in wait_timeout-style guards before live use.
Structs§
- Tool
Check - A single preflight check.
Enums§
- Tool
Check Outcome - Outcome of a single
ToolCheck.
Constants§
- MIN_
AWS_ VERSION - Minimum supported AWS CLI v2 version.
- MIN_
AZ_ VERSION - Minimum supported Azure CLI version.
- MIN_
DOCKER_ VERSION - Minimum supported Docker version.
- MIN_
GCLOUD_ VERSION - Minimum supported gcloud version.
- MIN_
HELM_ VERSION - Minimum supported Helm version.
- MIN_
KUBECTL_ VERSION - Minimum supported kubectl version.
- MIN_
PODMAN_ VERSION - Minimum supported Podman version (Docker-equivalent OCI runtime).
- MIN_
TERRAFORM_ VERSION - Minimum supported Terraform version. We prefer OpenTofu (see plan §7 C3); Terraform is still accepted for environments stuck on it.
- MIN_
TOFU_ VERSION - Minimum supported OpenTofu version. Bumped as the deployer adopts newer HCL features.
Functions§
- aws
- Check
awsis installed and at or aboveMIN_AWS_VERSION. - aws_
caller_ identity aws sts get-caller-identity— verifies AWS credentials are configured and usable.regionis optional; when present it is passed as--region.- az
- Check
azis installed and at or aboveMIN_AZ_VERSION. - az_
account_ show az account show— verifies an Azure subscription is selected and the session is not expired.- check_
binary_ present - Verify a binary is on
$PATHby invoking it with the givenargs(typically--version). - check_
version_ probe - Verify a binary’s
--version-style output parses to aVersionthat satisfiesrequired. Theparserextracts aVersionfrom the raw stdout — different tools embed their version in different shapes, so the caller owns the regex /split_whitespacechoice. - docker
- Check
dockeris installed and at or aboveMIN_DOCKER_VERSION. - gcloud
- Check
gcloudis installed and at or aboveMIN_GCLOUD_VERSION. - gcloud_
auth_ list gcloud auth list --filter=status:ACTIVE— verifies a gcloud authentication is active.- helm
- Check
helmis installed and at or aboveMIN_HELM_VERSION. - kubectl
- Check
kubectlis installed and at or aboveMIN_KUBECTL_VERSION. - kubectl_
can_ i kubectl auth can-i <verb> <resource> [-n <namespace>]— verifies the configured kubeconfig has the requested permission on the cluster. This goes beyond binary-present: it surfaces both kubeconfig reachability and RBAC sufficiency in one probe.- parse_
first_ semver_ token - Extract a
MAJOR.MINOR.PATCHfrom the first token that parses as one. Strips a leadingvand drops any suffix after-/+sov1.5.7-rc1parses as1.5.7./is a separator soaws-cli/2.15.0 Python/3.11.6yields2.15.0. - parse_
kubectl_ version - Parses the first
MAJOR.MINOR.PATCHfrom akubectl version --client --output=yaml-style or plain--versionstring. Falls back toparse_first_semver_token. - podman
- Check
podmanis installed and at or aboveMIN_PODMAN_VERSION. - terraform
- Check
terraformis installed and at or aboveMIN_TERRAFORM_VERSION. Prefertofufor new environments — Terraform shells are accepted for legacy compatibility only. - tofu
- Check
tofuis installed and at or aboveMIN_TOFU_VERSION.