Skip to content

Simply running make bin is not sufficient when testing changes #1547

Closed as not planned

Description

@mafredri

OS Information

  • OS: macOS (Intel, amd64)
  • coder --version: Coder v0.0.0-devel+ba818b3 Wed May 18 00:07:20 UTC 2022 ba818b3

Steps to Reproduce

  1. Have coder repo in some fringe state with old builds and what not
  2. Run make bin
  3. Run coder server --dev ...
  4. Run coder templates create -d examples/docker-local
  5. Run coder create dev
  6. See error in Docker container: Syntax error: redirection unexpected (not reproducible after make build)

Expected

No error, or protection against serving an incompatible agent binary.

It seems coder server is serving an incompatible agent for the given architecture. I'm not entirely sure how my project ended up in that state, but it's something that could possibly trip up someone contributing to this project, or prefer to build it themselves.

Actual

Workspace creation fails:

  docker_container.workspace[0]: Creating...
  docker_container.workspace[0]: Creation errored after 1s
  Error: container exited immediately

✘ Starting workspace [5921ms]
exit status 1

(The lack of error information is already documented in #1544, this is not about that.)

If we view the docker log we simply see:

Syntax error: redirection unexpected

Indicating that the binary was incompatible with the target architecture (server macOS amd64, container linux amd64).

Notes

I've not dug into exactly what went wrong here, it could be that the issue sits between keyboard and chair.

Running make bin isn't perhaps the supported approach, but I imagine simply running go build -tags embed ./cmd/coder or make dev could have similar issues given the right circumstance.

Activity

  1. changed the title [-]Bug: Simply running `make bin` is not sufficient when testing changes[/-] [+]Simply running `make bin` is not sufficient when testing changes[/+] on Jun 7, 2022
  2. deansheather commented on Jun 19, 2022

    @deansheather
    Collaborator

    Syntax error: redirection unexpected actually doesn't indicate that it was incompatible, it just means you didn't download an ELF file. This is probably the SPA index.html file, which we shouldn't serve on 404 under /bin/ but we do due to a bug #2510

  3. deansheather commented on Jun 19, 2022

    @deansheather
    Collaborator

    ... which probably means you ran a slim binary instead of a full binary. The build order for coder is site, slim binaries, fat binaries. We need to build the slim binaries first because the fat binaries have to embed the slim binaries for the agents. The slim binaries are built without -tags embed.

    (make build does it in the correct order, and make bin prints a warning telling you that slim binaries are only for CLI usage and not for servers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions