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

COCKROACH_ARGS environment variable not working as expected #122441

Closed
DennieDev opened this issue Apr 16, 2024 · 2 comments · Fixed by #122551
Closed

COCKROACH_ARGS environment variable not working as expected #122441

DennieDev opened this issue Apr 16, 2024 · 2 comments · Fixed by #122551
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-dev-inf

Comments

@DennieDev
Copy link

DennieDev commented Apr 16, 2024

Using COCKROACH_ARGS with flags instead of just a single command results in a failure.
This is due to a fault in /cockroach/cockroach.sh.

Error:

ERROR: unknown command "start --insecure" for "cockroach"

Please describe the issue you observed, and any steps we can take to reproduce it:

To Reproduce

  1. Start a docker container using the COCKROACH_ARGS variable as 'start --insecure'

Example:

version: "3.9"
services:
   
  cockroach:
    hostname: "node_{{.Node.Hostname}}"
    image: cockroachdb/cockroach:v23.2.4
    network_mode: host
    environment:
      COCKROACH_ARGS: 'start --insecure'
    deploy:
      replicas: 1
    ports:
      - 26257:26257
      - 26357:26357
      - 18080:8080

Expected behavior
It should just pass the flags as normal instead of matching it all as a single command, this is due to a fault in the /cockroach/cockroach.sh file.

Additional context
The fix is changing:

if [[ -n "$COCKROACH_ARGS" ]]; then
  _main "$COCKROACH_ARGS"
else
  _main "$@"
fi

To:

if [[ -n "$COCKROACH_ARGS" ]]; then
  _main $COCKROACH_ARGS
else
  _main "$@"
fi

Because of the "" it's matching the entire variable as a single command.

Jira issue: CRDB-37892

@DennieDev DennieDev added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Apr 16, 2024
Copy link

blathers-crl bot commented Apr 16, 2024

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-untriaged blathers was unable to find an owner labels Apr 16, 2024
@xinhaoz
Copy link
Member

xinhaoz commented Apr 16, 2024

Tagged @cockroach-dev-inf given this PR but feel free to reassign if this is not your area of ownership!

@yuzefovich yuzefovich removed the X-blathers-untriaged blathers was unable to find an owner label Apr 16, 2024
@rail rail self-assigned this Apr 19, 2024
craig bot pushed a commit that referenced this issue Apr 19, 2024
122551: docker: pass `COCKROACH_ARGS` without quoting r=rickystewart a=rail

Previously, the `COCKROACH_ARGS` variable was passed quoted, what converted it into a single string. If the variable is set to something more than one word, the whole string is passed as a single argument.

This PR removes the surrounding quotes to let field splitting convert the string into multiple arguments.

Fixes: #122441
Release note: None

Co-authored-by: Rail Aliiev <rail@iqchoice.com>
@craig craig bot closed this as completed in f1eb28a Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-dev-inf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants