-
-
Notifications
You must be signed in to change notification settings - Fork 135
Implement atmos toolchain to install 3rd party tools #1386
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
Conversation
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a new “toolchain” subsystem: CLI commands under cmd/, core implementation under toolchain/ (installer, registry, HTTP/GitHub clients, version-file management, PATH emission, exec/run, list/info UI, uninstall/clean), schema support for toolchain config, docs and screengrabs, tests, and minor project housekeeping (go.mod, .gitignore, snapshots). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CLI as atmos toolchain exec
participant TC as toolchain.RunExecCommand
participant Inst as Installer
participant FS as Filesystem
participant OS as OS (exec)
User->>CLI: atmos toolchain exec terraform@1.11.4 --version
CLI->>TC: RunExecCommand(args)
TC->>Inst: GetResolver().Resolve("terraform")
alt binary exists
TC->>Inst: FindBinaryPath(owner, repo, version)
else not installed
TC->>Inst: (ensure) Install(owner, repo, version)
Inst->>FS: download/cache/extract/install
FS-->>Inst: path
TC->>Inst: FindBinaryPath(...)
end
TC->>OS: exec(binaryPath, args, env)
OS-->>User: replaced process
sequenceDiagram
autonumber
actor User
participant CLI as atmos toolchain install
participant Flow as RunInstall
participant Vers as .tool-versions
participant Inst as Installer
participant Reg as Registry (local/aqua)
participant FS as Filesystem
User->>CLI: atmos toolchain install
CLI->>Flow: RunInstall("", setDefault=false, reinstall=false)
Flow->>Vers: LoadToolVersions(file)
loop each tool@versions
Flow->>Reg: Resolve owner/repo
alt already installed and !reinstall
Flow->>Flow: skip
else install
Flow->>Inst: Install(owner, repo, version)
Inst->>FS: download/cache/extract
FS-->>Inst: binary path
end
end
Flow-->>User: summary (installed/failed/skipped)
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1386 +/- ##
==========================================
+ Coverage 55.94% 56.11% +0.17%
==========================================
Files 274 311 +37
Lines 28936 32441 +3505
==========================================
+ Hits 16188 18204 +2016
- Misses 10956 12271 +1315
- Partials 1792 1966 +174
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
💥 This pull request now has conflicts. Could you fix it @goruha? 🙏 |
|
Let's close this and have you (@samtholiya) open the pull request. |
|
|
Describe the Feature
Atmos should automatically add the packages base-path as a priority search PATH when executing any commands.
Expected Behavior
Packages are automatically installed and available to atmos components, custom commands, and workflows.
When running
atmos terraform planand it depends onopentofu@1.10.3, if not installed it should automatically install it (if it's configured).When running a custom command, that needs
tflint, it should be able to automatically install it.When running a workflow that needs
tfsec, it should automatically install it.Use Case
usekeywordDescribe Ideal Solution
Atmos Commands
Atmos Configuration
The
usekeyword will installatmosat version1.183.1, then callsyscall.Execto replace the current process with the atmos at the correct version, if the current version is not already 1.183.1.Aliases
Aliases map a short name like
opentofuto a registry configuration ofopentofu/opentofuorterraformto something likehashicorp/terraformTool Versions
We should use the simple
.tool-versionsconvention popularized byasdfThe first semver is the default version, when nothing is specified
This file is consulted when calling install/uninstall/add/remove.
We should use aliases in this file to refer to toolchain tools. This is so we can change the mapping in the future.
Aqua Registry Configuration
We're going to add partial Aqua support for registries and expand the implementation over time. To start, we want to support the essential packages we depend on.
Local Configuration
We also want a local toolchain configuration, when not depending on the Aqua registry.
Stack Configuration
When the
commandis evaluated, it's first checked against the toolchain, and if it's not installed, it will be automatically installed.The
PATHfor exec will be updated to use the directory containingterraformfor version1.11.4Workflows
Custom Commands
Alternatives Considered
Using
aquadirectly. However, the aims of the Aqua Project are different than our aims and Aqua does not expose an SDK or stable interfaces for other CLIs to use Aqua.https://github.com/suzuki-shunsuke
Summary by CodeRabbit