From f494a1d4ffd2ab23c7902d0991658fc82e43b488 Mon Sep 17 00:00:00 2001 From: ivinokur Date: Tue, 13 Aug 2024 17:40:08 +0300 Subject: [PATCH] Override the ssh-askpass.sh script to respect the workspace ssh key --- .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 8a15fd48080..d81689a4cf8 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 194de7894ac..b45ab14d88d 100755 --- a/rebase.sh +++ b/rebase.sh @@ -314,6 +314,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" @@ -371,6 +382,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