I have a Jenkins credential that store an app password for the Git account named: "app_pw_sentinel". In our Jenkins file i have this code:
withCredentials([usernamePassword(credentialsId: 'XXXX', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY', credentialsId: 'builduser', secretKeyVariable: 'AWS_SECRET_KEY']]) {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_RELEASE', credentialsId: 'jenkins_release_prod', secretKeyVariable: 'AWS_SECRET_KEY_RELEASE']]) {
def psScript = "${WORKSPACE}\\sentinel\\MSBuild\\Release-Sentinel.ps1";
def psArgs = "-BucketName \"YYYY\" -AccessKey \"${AWS_ACCESS_KEY}\" -SecretKey \"${AWS_SECRET_KEY}\" -Region \"us-east-1\" -BranchName \"${BRANCH_NAME}\" -Version \"${versionTag}\" -DocumentationBranch \"${params.DocumentationBranch}\" -GitUsername \"XXXX\" -GitPassword \"${app_pw_sentinel}\" -ReleaseBucketName \"ZZZZ\" -ReleaseAccessKey \"${AWS_ACCESS_KEY_RELEASE}\" -ReleaseSecretKey \"${AWS_SECRET_KEY_RELEASE}\" -ReleaseRegion \"us-east-1\"";
bat "powershell -ExecutionPolicy Bypass -File ${psScript} ${psArgs}";
in the Release-Sentinel.ps1 file i have this code that is not working:
git clone -n "https://$GitUsername`:$GitPassword@bitbucket.org/Lee/Lee-documentation.git";
Push-Location -Path './Lee-documentation';
in the Jenkins output log i will get: "fatal: Authentication failed for..."
What am i doing wrong here?
Note: This code worked before and stopped working after Bitbucket changed the way app using api to call Git.
Any help will be very helpful so thank you in advance...