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

docker-entrypoint doesn't properly identify atlantis subcommands #870

Closed
sparky005 opened this issue Dec 2, 2019 · 3 comments · Fixed by #877
Closed

docker-entrypoint doesn't properly identify atlantis subcommands #870

sparky005 opened this issue Dec 2, 2019 · 3 comments · Fixed by #877
Labels
bug Something isn't working

Comments

@sparky005
Copy link
Contributor

The docker entrypoint has the following snippet to identify if a given command is an atlantis subcommand

if atlantis --help "$1" 2>&1 | grep -q "atlantis $1"; then
    # We can't use the return code to check for the existence of a subcommand, so
    # we have to use grep to look for a pattern in the help output.
    set -- atlantis "$@"
fi

https://github.com/runatlantis/atlantis/blob/master/docker-entrypoint.sh#L19-L23

However, this doesn't work, as the atlantis --help output actually looks like this:

Terraform Pull Request Automation

Usage:
  atlantis [command]

Available Commands:
  help        Help about any command
  server      Start the atlantis server
  testdrive   Start a guided tour of Atlantis
  version     Print the current Atlantis version

Flags:
  -h, --help   help for atlantis

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

So this logic doesn't actually work for any subcommand other than "atlantis server," which itself only works because the description happens to contain the string "atlantis server."

@lkysow
Copy link
Member

lkysow commented Dec 2, 2019

Ahh yeah that's broken. It should be

- if atlantis --help "$1" 2>&1 | grep -q "atlantis $1"; then
+ if atlantis help "$1" 2>&1 | grep -q "atlantis $1"; then
    # We can't use the return code to check for the existence of a subcommand, so
    # we have to use grep to look for a pattern in the help output.
    set -- atlantis "$@"
fi

It should be running atlantis help <subcommand> not atlantis --help <subcommand>.
Want to PR it?

@lkysow lkysow added the bug Something isn't working label Dec 2, 2019
@sparky005
Copy link
Contributor Author

That's pretty straightforward. Sure, I can do that, might take me a few days though :)

@sparky005
Copy link
Contributor Author

@lkysow PR'd here #877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants