From e0f16d29cf0b3167dd1d2a46a5837262325d30a1 Mon Sep 17 00:00:00 2001 From: Ebtasam Faridy Date: Mon, 4 Aug 2025 02:03:01 +0530 Subject: [PATCH 1/3] feat: [CI-18088]: adding function to create _netrc in shared path --- windows/clone.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/windows/clone.ps1 b/windows/clone.ps1 index 6a8185a..0cc8371 100644 --- a/windows/clone.ps1 +++ b/windows/clone.ps1 @@ -21,6 +21,22 @@ password $Env:DRONE_NETRC_PASSWORD "@ > (Join-Path $Env:USERPROFILE '_netrc'); } +if ($Env:DRONE_PERSIST_CREDS) { + # Define the path to the file in the current user's profile + $sourcePath = Join-Path $Env:USERPROFILE '_netrc'; + + # Define the destination path in the shared volume + $destinationPath = 'C:\addon\shared\_netrc'; + + # Ensure the parent directory for the destination exists + New-Item -ItemType Directory -Path (Split-Path $destinationPath) -Force; + + # Check if the file was created and then copy it to the shared volume + if (Test-Path -Path $sourcePath) { + Copy-Item -Path $sourcePath -Destination $destinationPath -Force; + } +} + if ($Env:DRONE_SSH_KEY) { mkdir C:\.ssh -Force echo $Env:DRONE_SSH_KEY > C:\.ssh\id_rsa From 4c5a4946f79f0eb7ce8f73e197d4e9bed7e672f2 Mon Sep 17 00:00:00 2001 From: Ebtasam Faridy Date: Mon, 4 Aug 2025 15:13:51 +0530 Subject: [PATCH 2/3] feat: [CI-18088]: adding function to create _netrc in shared path --- windows/clone.ps1 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/windows/clone.ps1 b/windows/clone.ps1 index 0cc8371..c7ffc06 100644 --- a/windows/clone.ps1 +++ b/windows/clone.ps1 @@ -22,16 +22,9 @@ password $Env:DRONE_NETRC_PASSWORD } if ($Env:DRONE_PERSIST_CREDS) { - # Define the path to the file in the current user's profile $sourcePath = Join-Path $Env:USERPROFILE '_netrc'; - - # Define the destination path in the shared volume $destinationPath = 'C:\addon\shared\_netrc'; - - # Ensure the parent directory for the destination exists New-Item -ItemType Directory -Path (Split-Path $destinationPath) -Force; - - # Check if the file was created and then copy it to the shared volume if (Test-Path -Path $sourcePath) { Copy-Item -Path $sourcePath -Destination $destinationPath -Force; } From 28071a03655b1d5918d75f77b18f5ea888e6afa3 Mon Sep 17 00:00:00 2001 From: Ebtasam Faridy Date: Fri, 8 Aug 2025 14:08:08 +0530 Subject: [PATCH 3/3] feat: [CI-18088]: adding comment --- windows/clone.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/windows/clone.ps1 b/windows/clone.ps1 index c7ffc06..c638a1b 100644 --- a/windows/clone.ps1 +++ b/windows/clone.ps1 @@ -21,6 +21,8 @@ password $Env:DRONE_NETRC_PASSWORD "@ > (Join-Path $Env:USERPROFILE '_netrc'); } +# Windows-specific: Persist Git credentials by mounting _netrc from the shared path +# so that subsequent steps in the pipeline can use them for authenticated Git operations. if ($Env:DRONE_PERSIST_CREDS) { $sourcePath = Join-Path $Env:USERPROFILE '_netrc'; $destinationPath = 'C:\addon\shared\_netrc';