Compare commits

...

4 commits

Author SHA1 Message Date
7c093eb3da vs goad 2023-05-26 06:15:49 -07:00
b97c87c6db Fixup debug ephemeral 2023-05-26 06:15:49 -07:00
b132f553ea custom 2023-05-26 06:15:49 -07:00
fb5d9c7ec3 Format on save 2023-05-26 06:15:49 -07:00
4 changed files with 42 additions and 19 deletions

View file

@ -58,7 +58,7 @@
'(org-odd-levels-only t) '(org-odd-levels-only t)
'(org-todo-keywords '((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED"))) '(org-todo-keywords '((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED")))
'(package-selected-packages '(package-selected-packages
'(earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow)) '(nyan-mode earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow))
'(reb-re-syntax 'string) '(reb-re-syntax 'string)
'(rmail-mail-new-frame t) '(rmail-mail-new-frame t)
'(safe-local-variable-values '(safe-local-variable-values

View file

@ -367,6 +367,7 @@
(c++-mode . eglot-ensure) (c++-mode . eglot-ensure)
(c-mode . eglot-ensure) (c-mode . eglot-ensure)
(go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go (go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go
(before-save . eglot-format) ;; 2023-05-25 Format buffers on save
:bind :bind
("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier. ("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier.
:config :config

View file

@ -29,14 +29,17 @@ def slug():
def get_default_target(namespace, pod): def get_default_target(namespace, pod):
pod = json.loads( kubectl = subprocess.run(
subprocess.run( ["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"],
["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"], stdout=subprocess.PIPE,
check=True, stderr=subprocess.STDOUT,
capture_output=True, encoding="utf-8",
encoding="utf-8",
).stdout
) )
if kubectl.returncode != 0:
print(f"Unable to find job: {kubectl.stdout}")
sys.exit(1)
pod = json.loads(kubectl.stdout)
annotation_default = ( annotation_default = (
pod.get("metadata", {}) pod.get("metadata", {})
@ -62,14 +65,14 @@ def get_pod_container_state(namespace, pod, container):
statuses = pod.get("status", {}).get("ephemeralContainerStatuses", []) statuses = pod.get("status", {}).get("ephemeralContainerStatuses", [])
for status in statuses: for status in statuses:
if status.get("name", None) != container: if status.get("name", None) != container:
state_keys = list(status.get("state", {"waiting": {}}).keys()) state_keys = list(status.get("state", {}).keys())
if len(state_keys) == 0: if len(state_keys) == 0:
return "waiting" return "no keys"
if len(state_keys) > 1: if len(state_keys) > 1:
return "INTERNAL ERROR" return "internal error"
return state_keys[0] return state_keys[0]
return None return f"not found in pod {pod}"
def create_debugger_container(namespace, pod, target, image): def create_debugger_container(namespace, pod, target, image):
@ -83,7 +86,9 @@ def create_debugger_container(namespace, pod, target, image):
service_line = proxy.stdout.readline().decode("utf-8").strip() service_line = proxy.stdout.readline().decode("utf-8").strip()
PREFIX = "Starting to serve on 127.0.0.1:" PREFIX = "Starting to serve on 127.0.0.1:"
if not service_line.startswith(PREFIX): if not service_line.startswith(PREFIX):
raise Exception("Cannot get the port from the kubectl proxy") print(f"Cannot get the port from the kubectl proxy: {service_line}")
sys.exit(1)
port = service_line[len(PREFIX) :] port = service_line[len(PREFIX) :]
# Pod must exist, yay! # Pod must exist, yay!
@ -128,7 +133,8 @@ def create_debugger_container(namespace, pod, target, image):
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
) )
if curl.returncode != 0: if curl.returncode != 0:
raise Exception(f"curl failed with code {curl.returncode}:\n{curl.stdout}") print(f"curl failed with code {curl.returncode}: {curl.stdout}")
sys.exit(1)
return container_name return container_name
@ -152,6 +158,7 @@ def attach_debugger(namespace, pod, target, image):
# Wait for the dang container to be ready. # Wait for the dang container to be ready.
for i in range(3000): for i in range(3000):
state = get_pod_container_state(namespace, pod, container) state = get_pod_container_state(namespace, pod, container)
print(f"{container}: {state}")
if state == "running": if state == "running":
break break
time.sleep(0.100) # 100ms time.sleep(0.100) # 100ms

View file

@ -1,6 +1,8 @@
{ {
"breadcrumbs.enabled": true, "breadcrumbs.enabled": true,
"editor.rulers": [80], "editor.rulers": [
80
],
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.formatOnPaste": true, "editor.formatOnPaste": true,
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
@ -47,7 +49,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[cpp]": { "[cpp]": {
"editor.defaultFormatter": "nuclide.cpp" "editor.defaultFormatter": "ms-vscode.cpptools"
}, },
"pyls.BuckFormatOnSave": true, "pyls.BuckFormatOnSave": true,
"pyls.formatAlreadyFormattedFilesOnSave": true, "pyls.formatAlreadyFormattedFilesOnSave": true,
@ -88,10 +90,23 @@
"remote.SSH.showLoginTerminal": true, "remote.SSH.showLoginTerminal": true,
"remote.SSH.remotePlatform": { "remote.SSH.remotePlatform": {
"coder.doty-dev": "linux", "coder.doty-dev": "linux",
"coder.doty-dev2": "linux" "192.168.0.114": "linux",
"coder-vscode--johndoty--doty-dev": "linux"
}, },
"java.import.maven.enabled": false, "java.import.maven.enabled": false,
"remote.autoForwardPortsSource": "process", "remote.autoForwardPortsSource": "process",
"go.toolsManagement.autoUpdate": true, "go.toolsManagement.autoUpdate": true,
"bazel.queriesShareServer": true "bazel.queriesShareServer": true,
} "remote.portsAttributes": {
"443": {
"protocol": "https"
},
"8443": {
"protocol": "https"
}
},
"[python]": {
"editor.formatOnType": true
},
"git.confirmSync": false
}