Skip to content

Commit

Permalink
package manager for vendor pull (#768)
Browse files Browse the repository at this point in the history
* Add  dependency to go.mod and update go.sum

* add pkg installer

* Refactor package handling to support dry run functionality and introduce package types

* Refactor local file handling in downloadAndInstall function

* Refactor downloadAndInstall function to use a temporary directory for package handling

* Enhance model to track failed packages during installation process

* Add version field to pkg update success message

* Enhance file inclusion/exclusion logic to support patterns and improve logging

* improve log

* remove repeated call of copyToTarget

* Add error handling for unknown package types in downloadAndInstall

* Implement vendor model with package management and installation logic

* Refactor package handling to use pkgAtmosVendor struct and update related functions

* Add support for daemon mode in TUI by conditionally disabling renderer

* Add detailed logging for package installation errors in vendor model

* Fix index out of bounds errors in vendor model by adding checks before accessing packages

* Add nil checks for empty packages in vendor model initialization

* Add nil check for os.Stdin in daemon mode TUI rendering logic

* Refactor TUI rendering logic to use CheckTTYSupport for better terminal compatibility

* Add TTY support check to disable TUI rendering when not available

* Refactor CheckTTYSupport to improve TTY detection on Linux and macOS

* debug stdout support TTY

* Refactor CheckTTYSupport to only check stdin TTY support and simplify rendering options

* Suppress log output when TTY support is not available in vendor execution

* Remove log output suppression and add TTY support messages for non-interactive mode

* Add TTYSupport field to modelAtmosVendorInternal and update logic for non-interactive mode

* Refactor modelAtmosVendorInternal to remove TTYSupport field and related logic

* Add progress bar to modelAtmosVendorInternal for package installation updates

* package pull status when TTY support is unavailable

* Enhance TTY support check to include stdout terminal status

* Implement non-interactive mode with spinner feedback and remove TTY dependency

* Update bubbletea and ansi dependencies to latest versions

* Remove vendor_tty.go and update non-interactive mode handling in vendor_utils.go

* Fix non-interactive mode handling by adding input option for TTY support check

* Refactor TTY support check to only evaluate stdin and update comments for clarity

* Add '--everything' flag to vendor pull command and update handling logic

* Update atmos.yaml to include '--everything' flag in vendor pull command

* Add '--everything' flag to vendor pull command in atmos.yaml

* refactor: update vendor component handling and improve error logging

* feat: add '--everything' flag to 'atmos vendor pull' command in documentation

* refactor: improve TTY support checks and enhance logging messages; add URI validation

* refactor: implement context timeout for package download process

* chore: remove outdated dependencies from go.sum

* refactor: improve error messages and flag validation in ExecuteVendorPullCommand

* refactor: update modelVendor return value to indicate completion when no packages are provided

* feat: enhance URI validation in `validateURI` function

* refactor: improve error handling and logging in vendor operations

* fix: update receiver types for modelVendor methods and improve error messages

* fix: add validation for invalid characters in URI

* refactor: simplify CheckTTYSupport function to only check stdout TTY support

* fix: improve pkgType.String method and enhance temp directory creation error handling

* fix: enhance error handling for temp directory creation and permissions

* fix: add local file check in ExecuteComponentVendorInternal function

* fix: add example command for vendor pull in cheatsheet documentation

* fix: update vendor pull command example in documentation

* fix: update vendor pull command example in cheatsheet documentation

* fix: add example command for vendor pull in documentation

* fix: simplify vendor pull command example in documentation

* some fixes

* fix handle the OCI images

* fix: improve error handling and logging in vendor update process

* fix: correct URI trimming for OCI scheme in determineSourceType function

* fix: enhance error messages and improve TTY handling in vendor execution

* Enhance error messages and validation in vendor utilities

* updates

* not emit pulling log on basic output

* merge maine into branch resolve conflict

* replace path wit filepath pkg

* updates

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: aknysh <[email protected]>
Co-authored-by: Andriy Knysh <[email protected]>
  • Loading branch information
4 people authored Dec 18, 2024
1 parent c4fe769 commit 1defdce
Show file tree
Hide file tree
Showing 17 changed files with 1,025 additions and 460 deletions.
2 changes: 1 addition & 1 deletion cmd/vendor_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ func init() {
vendorPullCmd.PersistentFlags().StringP("type", "t", "terraform", "atmos vendor pull --component <component> --type=terraform|helmfile")
vendorPullCmd.PersistentFlags().Bool("dry-run", false, "atmos vendor pull --component <component> --dry-run")
vendorPullCmd.PersistentFlags().String("tags", "", "Only vendor the components that have the specified tags: atmos vendor pull --tags=dev,test")

vendorPullCmd.PersistentFlags().Bool("everything", false, "Vendor all components: atmos vendor pull --everything")
vendorCmd.AddCommand(vendorPullCmd)
}
2 changes: 1 addition & 1 deletion examples/demo-component-versions/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ commands:
- name: "test"
description: "Run all tests"
steps:
- atmos vendor pull
- atmos vendor pull --everything
2 changes: 1 addition & 1 deletion examples/demo-vendoring/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ commands:
- name: "test"
description: "Run all tests"
steps:
- atmos vendor pull
- atmos vendor pull --everything
2 changes: 1 addition & 1 deletion examples/quick-start-advanced/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG GEODESIC_OS=debian
# https://atmos.tools/
# https://github.com/cloudposse/atmos
# https://github.com/cloudposse/atmos/releases
ARG ATMOS_VERSION=1.129.0
ARG ATMOS_VERSION=1.130.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.5.7
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require (
github.com/jwalton/go-supportscolor v1.2.0
github.com/kubescape/go-git-url v0.0.30
github.com/lrstanley/bubblezone v0.0.0-20240914071701-b48c55a5e78e
github.com/mattn/go-isatty v0.0.20
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-wordwrap v1.0.1
github.com/mitchellh/mapstructure v1.5.0
Expand Down Expand Up @@ -98,6 +99,7 @@ require (
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chainguard-dev/git-urls v1.0.2 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/x/ansi v0.4.5 // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
Expand Down Expand Up @@ -175,7 +177,6 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ github.com/charmbracelet/bubbletea v1.2.4 h1:KN8aCViA0eps9SCOThb2/XPIlea3ANJLUkv
github.com/charmbracelet/bubbletea v1.2.4/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs=
github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/huh v0.6.0 h1:mZM8VvZGuE0hoDXq6XLxRtgfWyTI3b2jZNKh0xWmax8=
github.com/charmbracelet/huh v0.6.0/go.mod h1:GGNKeWCeNzKpEOh/OJD8WBwTQjV3prFAtQPpLv+AVwU=
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
Expand Down
Loading

0 comments on commit 1defdce

Please sign in to comment.