Skip to content
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

updated/fixed hauler directory #354

Merged
merged 10 commits into from
Nov 15, 2024

Conversation

zackbradys
Copy link
Member

@zackbradys zackbradys commented Nov 2, 2024

Please check below, if the PR fulfills these requirements:

  • Commit(s) and code follow the repositories guidelines.
  • Test(s) have been added or updated to support these change(s).
  • Doc(s) have been added or updated to support these change(s).

Associated Links:

Types of Changes:

  • Feature

Proposed Changes:

  • Added environment variable to configure the location of the hauler directory... HAULER_DIR
    • this directory is used for storing all config files, install.sh artifacts, and binaries
  • Updated the install.sh script to use the same environment variable/argument as HAULER_DIR instead of the previously hard coded $HOME/.hauler
  • Added environment variable to configure the location of the hauler temp directory... HAULER_TEMP_DIR
    • this directory is used for temporarily storing artifacts when using various commands
  • Added small comments to hauler/hauler help to state available environment variables

Verification/Testing of Changes:

  • git clone https://github.com/zackbradys/hauler.git && cd hauler && make build

Changes to CLI Comments...

zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64/hauler 
Airgap Swiss Army Knife

Usage:
  hauler [flags]
  hauler [command]

Examples:
  View the Docs: https://docs.hauler.dev
  Environment Variables: HAULER_DIR | HAULER_TEMP_DIR

Available Commands:
  completion  Generate auto-completion scripts for various shells
  help        Help about any command
  login       Login to a registry
  store       Interact with the content store
  version     Print the current version

Flags:
  -h, --help               help for hauler
  -l, --log-level string    (default "info")

Use "hauler [command] --help" for more information about a command.

New HAULER_DIR Environment Variable...

zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64/hauler store info
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@Zacks-MacBook-Pro hauler % ls /Users/zackbradys/.hauler
cosign
zackbradys@Zacks-MacBook-Pro hauler % rm -rf /Users/zackbradys/.hauler
zackbradys@Zacks-MacBook-Pro hauler % ls /Users/zackbradys/.hauler    
ls: /Users/zackbradys/.hauler: No such file or directory
zackbradys@Zacks-MacBook-Pro hauler % export HAULER_DIR=/Users/zackbradys/Downloads/haulertesting 
zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64/hauler store info
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@Zacks-MacBook-Pro hauler % ls /Users/zackbradys/.hauler 
ls: /Users/zackbradys/.hauler: No such file or directory
zackbradys@Zacks-MacBook-Pro hauler % ls /Users/zackbradys/Downloads/haulertesting 
cosign

New HAULER_TEMP_DIR Environment Variable...

zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64/hauler store load testdata/haul.tar.zst
2024-11-02 15:03:00 INF loading content from [testdata/haul.tar.zst] to [store]

zackbradys@Zacks-MacBook-Pro ~ % fswatch -0 /var/folders/5f/lyy8pc6s62dbckp8sy31ft5r0000gn/T/ | grep -z "hauler" 
/private/var/folders/5f/lyy8pc6s62dbckp8sy31ft5r0000gn/T/hauler1872136313/oci-layout .... everything else
zackbradys@Zacks-MacBook-Pro hauler % export HAULER_TEMP_DIR=/Users/zackbradys/Downloads/haulertesting/temp 
zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64/hauler store load testdata/haul.tar.zst   
2024-11-02 15:06:40 INF loading content from [testdata/haul.tar.zst] to [store]

zackbradys@Zacks-MacBook-Pro ~ % fswatch -0 /var/folders/5f/lyy8pc6s62dbckp8sy31ft5r0000gn/T/ | grep -z "hauler"

zackbradys@Zacks-MacBook-Pro haulertesting % fswatch -0 temp | grep -z "hauler"
/Users/zackbradys/Downloads/haulertesting/temp/hauler236565745/oci-layout .... everything else

New HAULER_DIR to install.sh...

zackbradys@Zacks-MacBook-Pro Downloads % curl -sfL https://raw.githubusercontent.com/zackbradys/hauler/refs/heads/fixed-hauler-directory/install.sh | sudo HAULER_DIR=/opt/hauler bash

[INFO] Hauler: Starting Preflight Checks...

[INFO] Hauler: Starting Installation...
- Version: v1.1.0
- Platform: darwin
- Architecture: arm64
- Install Directory: /usr/local/bin
- Hauler Directory: /opt/hauler

[INFO] Hauler: Starting Download...

[INFO] Hauler: Starting Checksum Verification...
- Expected Checksum: 8b03f8b7f49dcfe5eaa1e143bffbd2c0625d792dec0e55dce79b1c48e6da7a8c
- Determined Checksum: 8b03f8b7f49dcfe5eaa1e143bffbd2c0625d792dec0e55dce79b1c48e6da7a8c
- Successfully Verified Checksum: hauler_1.1.0_darwin_arm64.tar.gz

[INFO] Hauler: Successfully Installed Hauler at /usr/local/bin/hauler

[INFO] Hauler: Hauler v1.1.0 is now available for use!
- Documentation: https://hauler.dev

@zackbradys zackbradys requested a review from a team November 2, 2024 19:56
@zackbradys zackbradys self-assigned this Nov 2, 2024
@zackbradys zackbradys added enhancement New feature or request size/M Denotes an issue/PR requiring a relatively moderate amount of work labels Nov 2, 2024
@zackbradys zackbradys added this to the Hauler v1.1-next1 milestone Nov 2, 2024
@amartin120 amartin120 self-requested a review November 4, 2024 18:54
@amartin120
Copy link
Contributor

amartin120 commented Nov 4, 2024

Outside of any variable name suggestions from @dweomer, I'm happy with this PR. Thanks for tackling @zackbradys.

@hauler-dev/maintainers We should make sure that this is documented well. Maybe even include examples in the GitHub release notes whenever it's released.

pkg/cosign/cosign.go Outdated Show resolved Hide resolved
@zackbradys
Copy link
Member Author

Outside of any variable name suggestions from @dweomer, I'm happy with this PR. Thanks for tackling @zackbradys.

@hauler-dev/maintainers We should make sure that this is documented well. Maybe even include examples in the GitHub release notes whenever it's released.

I agree... I'll start work on a first draft of docs... @amartin120 @CamrynCarter

dweomer
dweomer previously approved these changes Nov 6, 2024
Copy link
Contributor

@dweomer dweomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, but we should probably bite the bullet and provide flag parity with the new envvars, aka --hauler-home and --hauler-temp (or --home and --temp) flags with the envvars overriding the default values for the flags.

@zackbradys
Copy link
Member Author

zackbradys@MacBookPro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store info
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@MacBookPro hauler % ./check.sh                                       

checking ~/.hauler...
cosign

checking ~/.haulersss...
ls: /Users/zackbradys/.haulersss: No such file or directory

checking ~/.haulersssss...
ls: /Users/zackbradys/.haulersssss: No such file or directory

removing directories...

zackbradys@MacBookPro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store info --haulerdir ~/.haulersss
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@MacBookPro hauler % ./check.sh                                                                

checking ~/.hauler...
ls: /Users/zackbradys/.hauler: No such file or directory

checking ~/.haulersss...
cosign

checking ~/.haulersssss...
ls: /Users/zackbradys/.haulersssss: No such file or directory

removing directories...

zackbradys@MacBookPro hauler % export HAULER_DIR=~/.haulersssss
zackbradys@MacBookPro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store info --haulerdir ~/.haulersss
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@MacBookPro hauler % ./check.sh                                                                

checking ~/.hauler...
ls: /Users/zackbradys/.hauler: No such file or directory

checking ~/.haulersss...
cosign

checking ~/.haulersssss...
ls: /Users/zackbradys/.haulersssss: No such file or directory

removing directories...

zackbradys@MacBookPro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store info                         
+-----------+------+----------+----------+------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+-----------+------+----------+----------+------+
+-----------+------+----------+----------+------+
|                                TOTAL   | 0 B  |
+-----------+------+----------+----------+------+
zackbradys@MacBookPro hauler % ./check.sh                                       

checking ~/.hauler...
ls: /Users/zackbradys/.hauler: No such file or directory

checking ~/.haulersss...
ls: /Users/zackbradys/.haulersss: No such file or directory

checking ~/.haulersssss...
cosign

removing directories...

@zackbradys zackbradys added size/L Denotes an issue/PR requiring a relatively large amount of work priority/review and removed size/M Denotes an issue/PR requiring a relatively moderate amount of work labels Nov 11, 2024
install.sh Show resolved Hide resolved
Copy link
Contributor

@dweomer dweomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, so, left a bunch of nits that we don't necessarily need to address right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/review size/L Denotes an issue/PR requiring a relatively large amount of work
Projects
Status: Resolved
3 participants