Skip to content

chore: Invert delay_login_until_ready, now login_before_ready #5893

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

Merged
Prev Previous commit
Next Next commit
Fix clidocgen
  • Loading branch information
mafredri committed Jan 27, 2023
commit d9fb8c6a1a6402d4eda6eff71e6856ff107424b7
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me
cd site
yarn run format:write:only ../docs/admin/prometheus.md

docs/cli/coder.md: scripts/clidocgen/main.go $(shell find ./cli/ -type f)
docs/cli/coder.md: scripts/clidocgen/main.go $(GO_SRC_FILES)
BASE_PATH="." go run scripts/clidocgen/main.go
cd site
yarn run format:write:only ../docs/cli/**.md
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/coder_ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ coder ssh <workspace> [flags]
-h, --help help for ssh
--identity-agent string Specifies which identity agent to use (overrides $SSH_AUTH_SOCK), forward agent must also be enabled.
Consumes $CODER_SSH_IDENTITY_AGENT
--no-wait Specifies whether to wait for a workspace to become ready before logging in (only applicable when the delay login until ready option is enabled). Note that the workspace agent may still be in the process of executing the startup script and the workspace may be in an incomplete state.
--no-wait Specifies whether to wait for a workspace to become ready before logging in (only applicable when the login before ready option has not been enabled). Note that the workspace agent may still be in the process of executing the startup script and the workspace may be in an incomplete state.
Consumes $CODER_SSH_NO_WAIT
--stdio Specifies whether to emit SSH output over stdin/stdout.
Consumes $CODER_SSH_STDIO
Expand Down
32 changes: 24 additions & 8 deletions scripts/clidocgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"log"
"os"
"os/user"
"path"
"regexp"
"strings"
Expand All @@ -29,14 +30,26 @@ type manifest struct {
}

func main() {
// Set default configs for the docs
err := os.Setenv("CODER_CONFIG_DIR", "~/.config/coderv2")
if err != nil {
log.Fatal("Unable to set default value for CODER_CONFIG_DIR: ", err)
for _, env := range os.Environ() {
if strings.HasPrefix(env, "CODER_") {
split := strings.SplitN(env, "=", 2)
if err := os.Unsetenv(split[0]); err != nil {
log.Fatal("Unable to unset ", split[0], ": ", err)
}
}
}
for k, v := range map[string]string{
"CODER_CONFIG_DIR": "~/.config/coderv2",
"CODER_CACHE_DIRECTORY": "~/.cache/coder",
} {
if err := os.Setenv(k, v); err != nil {
log.Fatal("Unable to set default value for ", k, ": ", err)
}
}
err = os.Setenv("CODER_CACHE_DIRECTORY", "~/.cache/coder")

u, err := user.Current()
if err != nil {
log.Fatal("Unable to set default value for CODER_CACHE_DIRECTORY: ", err)
log.Fatal("Error on getting the current user: ", err)
}

// Get the cmd CLI
Expand Down Expand Up @@ -97,7 +110,10 @@ func main() {
}
content = strings.ReplaceAll(content, dir, "<current-directory>")

err = os.WriteFile(filepath, []byte(content), 0644) // #nosec
// Remove all absolute home paths.
content = strings.ReplaceAll(content, u.HomeDir, "~")

err = os.WriteFile(filepath, []byte(content), 0o644) // #nosec
if err != nil {
log.Fatal("Error on save file at ", filepath, ": ", err)
}
Expand Down Expand Up @@ -127,7 +143,7 @@ func main() {
if err != nil {
log.Fatal("Error on marshal manifest.json: ", err)
}
err = os.WriteFile(manifestFilepath, manifestFile, 0644) // #nosec
err = os.WriteFile(manifestFilepath, manifestFile, 0o644) // #nosec
if err != nil {
log.Fatal("Error on write update on manifest.json: ", err)
}
Expand Down