From 029a3d97009ad469adeeea87d9d60bb6fbf104f6 Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Thu, 7 Nov 2024 09:29:56 +0200 Subject: [PATCH] Override the ssh-askpass.sh script to respect the workspace ssh key (#400) --- .rebase/CHANGELOG.md | 6 ++++++ code/extensions/git/src/ssh-askpass.sh | 6 ++---- rebase.sh | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.rebase/CHANGELOG.md b/.rebase/CHANGELOG.md index 8963aaecc60..7ac79e5594a 100644 --- a/.rebase/CHANGELOG.md +++ b/.rebase/CHANGELOG.md @@ -84,3 +84,9 @@ https://github.com/che-incubator/che-code/pull/353 - code/src/vs/server/node/extensionHostConnection.ts --- + +#### @vinokurig +https://github.com/che-incubator/che-code/pull/400 + +- code/extensions/git/src/ssh-askpass.sh +--- diff --git a/code/extensions/git/src/ssh-askpass.sh b/code/extensions/git/src/ssh-askpass.sh index dca45bc8404..1ce0b8df61d 100755 --- a/code/extensions/git/src/ssh-askpass.sh +++ b/code/extensions/git/src/ssh-askpass.sh @@ -1,5 +1,3 @@ #!/bin/sh -VSCODE_GIT_ASKPASS_PIPE=`mktemp` -ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" VSCODE_GIT_ASKPASS_TYPE="ssh" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $* -cat $VSCODE_GIT_ASKPASS_PIPE -rm $VSCODE_GIT_ASKPASS_PIPE +# see https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#configuring-devworkspaces-to-use-ssh-keys-for-git-operations +cat /etc/ssh/passphrase diff --git a/rebase.sh b/rebase.sh index d669005ac5f..ead2d317778 100755 --- a/rebase.sh +++ b/rebase.sh @@ -312,6 +312,17 @@ apply_code_src_vs_code_browser_workbench_workbench_changes() { git add code/src/vs/code/browser/workbench/workbench.ts > /dev/null 2>&1 } +# Apply changes on code/extensions/git/src/ssh-askpass.sh file +apply_code_extensions_git_src_ssh-askpass_changes() { + + echo " ⚙️ reworking code/extensions/git/src/ssh-askpass.sh..." + # reset the file from local + git checkout --ours code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1 + + # resolve the change + git add code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1 +} + # Apply changes for the given file apply_changes() { local filePath="$1" @@ -369,6 +380,8 @@ resolve_conflicts() { apply_code_vs_workbench_contrib_webview_browser_pre_index_no_csp_html_changes elif [[ "$conflictingFile" == "code/src/vs/code/browser/workbench/workbench.ts" ]]; then apply_code_src_vs_code_browser_workbench_workbench_changes + elif [[ "$conflictingFile" == "code/extensions/git/src/ssh-askpass.sh" ]]; then + apply_code_extensions_git_src_ssh-askpass_changes elif [[ "$conflictingFile" == "code/src/vs/base/common/product.ts" ]]; then apply_changes "$conflictingFile" elif [[ "$conflictingFile" == "code/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts" ]]; then