-
Notifications
You must be signed in to change notification settings - Fork 887
chore(dogfood): automatically login coder cli in dogfood workspaces #9462
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
This will auto-authenticate a user with coder in their dogfood workspace.
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.
Hmm. I wonder if we should do this via envs? Since envs override the config in e.g. ~/.config/coderv2
, this might lead to unexpected behavior.
But also, overwriting config in ~/.config/coderv2
may also lead to unexpected behavior.
Say I've logged in to a different coder instance, but every restart these settings are overridden (env) or overwritten. It would be interesting to introduce this mechanism into the agent.
Something like:
- Agent checks
[config_dir]/session
-
- If missing, write
session
,url
and.agent_managed_login
with same modified timestamp as session/url - If present, verify timestamp against
.agent_managed_login
and if they're the same, updatesession
andurl
- If present but diverge, do nothing
- If missing, write
Just an idea off the top of my head. Not sure what the right approach would be.
Then again, the envs are probably fine for now.
@mafredri Yes. Thanks for the idea. I faced this as this will automatically invalidate existing auth for any other coder deployment. I guess going the agent way will need some backend work to be done first. |
Maybe, but there may be another option, for instance:
When the user runs the coder command inside the workspace, it will first look for Step 2. can be automated by agent, if we want, but that may require introducing an option like |
@mafredri writing resource coder_agent {
auto_login = true
} And this will enable coder agent to automatically create the above session files given, we support fallback in cli. |
As @mafredri suggested, this change would mess up my workflow where I'm usually authenticated to my development deployment. That said, automatically logging in the user is a nice default since most of our users aren't developing Coder itself. The auto-login default should apply without template modifications. Using some kind of hierarchy of session token locations where the agents' is last is a good idea.
I don't think we should add configuration until there's a clear need. |
@ammario sure. Let us close this and move the discussion to a new issue. |
This will auto-authenticate a user with coder in their dogfood workspace.