-
Notifications
You must be signed in to change notification settings - Fork 904
feat: remove server subcommand from slim binaries #5747
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, had some small suggestions but pre-approving.
buildinfo/buildinfo.go
Outdated
@@ -73,6 +75,16 @@ func IsDev() bool { | |||
return strings.HasPrefix(Version(), develPrefix) | |||
} | |||
|
|||
// IsSlim returns true if this is a slim build. | |||
func IsSlim() bool { | |||
return strings.Contains(slim, "t") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we set this via build tag so that it's present when doing go build
as well? (I.e. we don't need to inject it via ldflags.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like by using go build -tags slim
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but we won't be able to detect agpl this way since we don't use a flag for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for slim, AGPL still uses ldflags. I've added a comment to build_go.sh
why we don't provide an agpl
build flag
"github.com/spf13/viper" | ||
|
||
"github.com/coder/coder/cli/deployment" | ||
"github.com/coder/coder/coderd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing coderd
here is unfortunate. I think we could reduce binary size if we didn't but I might be wrong. I think we can avoid it if we change enterprise slim too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly also root.go
uses this function so the signature needs to match on both. I think this could be done as a second improvement, but I want to get this in so we can unblock the community PR #5738
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't think of that. Yes makes sense 👍🏻.
slim
tag if this is a slim buildIsSlim()
andIsAGPL()
tobuildinfo
, and add those details tocoder version
server_slim.go
(in both AGPL and enterprise CLI) which only builds withslim
tagserveHandler
fromserver.go
toagent.go
This doesn't fully remove the server code from slim binaries, as the packages are still imported, but it disables them.