Skip to content
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

Using Sampler.AzureDevOpsTasks and BasicAuthPat results in git error #502

Open
raandree opened this issue Dec 4, 2024 · 1 comment
Open

Comments

@raandree
Copy link
Contributor

raandree commented Dec 4, 2024

Problem description

I want to host a Sampler project on Azure DevOps, hence I have added the tasks of Sampler.AzureDevOpsTasks tasks. I have added the variable BasicAuthPAT with the secret PAT to the pipeline and publish the variable to the tasks (BasicAuthPAT: $(BASICAUTHPAT)). The error I get is:

fatal: Unsupported SSL backend '"schannel"'. Supported SSL backends:
        schannel

The error does not seem to be an authentication problem but the way how git is called or the PAT is passed over to git. When joining the arguments to a string and calling git manually, things work. When using & git $Argument it fails.

PS D:\RaandreeSamplerTest2> $Argument -join ' ' | clip
PS D:\RaandreeSamplerTest2> git -c http.extraheader="AUTHORIZATION: basic UEFUOjVRVVlWUnZIYzFxUlRDVFYwTnlTTGlXSnNhZkVQZ3U5UmJlN2plRVhZNDRQeDlEMTN3a3NKUVFKOTlBTEFDQUFBQUFBQUFBQUFBQVNBWkRPMnIzNQ==" -c http.sslbackend="schannel" pull origin main --tag
From https://dev.azure.com/randree/RaandreeSamplerTest2/_git/RaandreeSamplerTest2
 * branch            main       -> FETCH_HEAD
Already up to date.
PS D:\RaandreeSamplerTest2> & git $Argument                                                                                                
fatal: Unsupported SSL backend '"schannel"'. Supported SSL backends:
        schannel
fatal: remote helper 'https' aborted session

Am I missing something?

Verbose logs

About to create the tag 'v0.2.0-preview0001' for module version '0.2.0-preview0001'.
        Setting git configuration.

        Getting HEAD commit for the default branch 'main.
        Creating tag 'v0.2.0-preview0001' on the commit '9a3e5cabb99220d9d5d29faa79a2263b0f2e85bd'.
        Pushing created tag 'v0.2.0-preview0001' to the default branch 'main'.
                Using personal access token to push the tag.
fatal: Unsupported SSL backend '"schannel"'. Supported SSL backends:
        schannel
fatal: remote helper 'https' aborted session
ERROR: git returned exit code 128 indicated failure.
At D:\RaandreeSamplerTest2\output\RequiredModules\Sampler\9.9.9\Sampler.psm1:1600 char:9
+         throw "git returned exit code $LASTEXITCODE indicated failure …
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At D:\RaandreeSamplerTest2\output\RequiredModules\Sampler\9.9.9\tasks\Create_Release_Git_Tag.build.ps1:98 char:1
+ task Create_Release_Git_Tag {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build FAILED. 3 tasks, 1 errors, 0 warnings 00:00:00.5162167
Exception: git returned exit code 128 indicated failure.

How to reproduce

https://dev.azure.com/randree/RaandreeSamplerTest2

Expected behavior

NA

Current behavior

NA

Suggested solution

NA

Operating system the target node is running

Windows 11

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module version used

0.118.2 preview0003
@raandree
Copy link
Contributor Author

raandree commented Dec 5, 2024

#Works
$BasicAuthPAT = '2IMG4Ybgc5M1YFViE6tYPJt7jsdxsI3W1oaCCyznIGSv4tDtrdt7JQQJ99ALACAAAAAAAAAAAAASAZDO9aVG'
$patBase64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(('{0}:{1}' -f 'PAT', $BasicAuthPAT)))

git -c http.extraheader="AUTHORIZATION: basic $patBase64" -c http.sslbackend="schannel" push origin

#-----------------------------------------------

#Results in error 128
$pushArguments = @()
$pushArguments += @('-c', ('http.extraheader="AUTHORIZATION: basic {0}"' -f $patBase64))    
$pushArguments += @('-c', 'http.sslbackend="schannel"', 'push', 'origin')
$pushArguments += @('push', 'origin')

Sampler\Invoke-SamplerGit -Argument $pushArguments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant