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

ci(dockerhub): fix garden version checks #4868

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Conversation

vvagaytsev
Copy link
Collaborator

Use new garden version command instead of discontinued garden --version.

What this PR does / why we need it:
Fixes the way of checking the Garden version in the docker-bake-test.sh script.

Without this PR the command fails silently with OK exit status like this:

USAGE
  garden <command> [options]

COMMANDS
  build          Perform your Builds.                                                     
  cleanup        Clean up resources.                                                      
  cloud          Manage Garden Cloud/Enterprise resources such as users, groups and       
                 secrets.                                                                 
  community      Join our community Discord to chat with us!                              
  config         Configure user and project settings.                                     
  create         Create new project or module.                                            
  deploy         Deploy actions to your environment.                                      
  dev            Starts the Garden interactive development console.                       
  exec           Executes a command (such as an interactive shell) in a running service.  
  get            Retrieve and output data and objects, e.g. secrets, status info etc.     
  link           Link a remote source or module to a local path.                          
  login          Log in to Garden Cloud.                                                  
  logout         Log out of Garden Cloud.                                                 
  logs           Retrieves the most recent logs for the specified Deploy(s).              
  options        Print global options.                                                    
  plugins        Plugin-specific commands.                                                
  publish        Build and publish artifacts (e.g. container images) to a remote          
                 registry.                                                                
  run            Perform one or more Run actions                                          
  self-update    Update the Garden CLI.                                                   
  serve          Starts the Garden Core API server for the current project and            
                 environment.                                                             
  set            Set or modify data and configuration values.                             
  sync           Manage synchronization to running actions.                               
  test           Run all or specified Test actions in the project.                        
  tools          Access tools included by providers.                                      
  unlink         Unlink a remote source or module from its local path.                    
  up             Spin up your stack with the dev console and streaming logs.              
  update-remote  Pulls the latest version of remote sources, actions or modules from      
                 their repository.                                                        
  util           Misc utility commands.                                                   
  validate       Check your garden configuration for errors.                              
  version        Shows the current garden version.                                        
  workflow       Run a Workflow.                                                          
    
OK: command run_binary garden --version gardendev/garden:bonsai-buster succeeded as expected

This PR replaces the old-fashioned discontinued garden --version with the new garden version command.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Use new `garden version` command instead of discontinued `garden --version`.
@vvagaytsev vvagaytsev requested a review from a team July 20, 2023 07:30
Copy link
Contributor

@Walther Walther left a comment

Choose a reason for hiding this comment

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

Nice catch! 🎉

Copy link
Contributor

@shumailxyz shumailxyz left a comment

Choose a reason for hiding this comment

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

Good catch 🌟

@vvagaytsev vvagaytsev merged commit 04dadb2 into main Jul 20, 2023
37 of 39 checks passed
@vvagaytsev vvagaytsev deleted the fix/docker-bake-test branch July 20, 2023 08:13
@stefreak
Copy link
Member

I think there's another issue here: Why does garden exit with code 0 when passing an unrecognized option? @vvagaytsev

@vvagaytsev
Copy link
Collaborator Author

I think there's another issue here: Why does garden exit with code 0 when passing an unrecognized option? @vvagaytsev

Yes, I think that should be changed too. It looks like the 0 error code comes from this block: https://github.com/garden-io/garden/blob/main/core/src/cli/cli.ts#L470-L474

@vvagaytsev
Copy link
Collaborator Author

Technically, it would be a breaking change. This is what we have now:

Garden 0.12

# Unrecognized command:
> garden bad
# usage output omitted

> echo $?
1

# Unrecognized option:
> garden --bad
# usage output omitted

> echo $?
0

# Unrecognized _command_ option:
> garden deploy --bad
# usage output omitted

> echo $?
1

Garden 0.13

# Unrecognized command:
> garden bad
# usage output omitted

> echo $?
1

# Unrecognized option:
> garden --bad
# usage output omitted

> echo $?
0

# Unrecognized _command_ option:
> garden deploy --bad
# usage output omitted

> echo $?
1

So, it looks like the edge case is when we pass options to garden, not to any of its commands. So it's technically a breaking change, but it would be semantically correct.

I think it makes sense to fix it in one of the next patch releases.

@stefreak
Copy link
Member

stefreak commented Aug 1, 2023

I agree this should be fixed in a patch release, IMO this is not a breaking change but a bug!

@vvagaytsev
Copy link
Collaborator Author

Created #4911.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants