adop-platform-management icon indicating copy to clipboard operation
adop-platform-management copied to clipboard

Fixed issue with http(s) credentials for bitbucket on prem SCM provider

Open RobeDevOps opened this issue 7 years ago • 3 comments

1. Fixing issue with credentials file

The first error was related was a wrong path for SCM_KEY file.

fatal: could not read Password for 'https://<USERNAME>@<BITBUCKET_DOMAIN>': No such device or address
Build step 'Execute shell' marked build as failure

So, in order to be able to read the credentials from SCM_KEY file I changed the path from:

[ -f ${WORKSPACE}/${SCM_KEY} ]

To

[ -f ${WORKSPACE}@tmp/secretFiles/${SCM_KEY} ]

2. Issue with URL

The second issue was related with the CARTRIDGE_CLONE_URL. It was using the whole URL and that was an error because just need the source URL without the username in the beginning. So the code was changed from:

git clone ${CARTRIDGE_CLONE_URL%://*}://${SCM_USERNAME}:${SCM_PASSWORD}@${CARTRIDGE_CLONE_URL#*://} cartridge

To:

git clone ${PROTOCOL}://${SCM_USERNAME}:${SCM_PASSWORD}@${BITBUCKET_REPOSITORY} cartridge

Where PROTOCOL and BITBUCKET_REPOSITORY are:

PROTOCOL=${CARTRIDGE_CLONE_URL%://*}
BITBUCKET_REPOSITORY="${CARTRIDGE_CLONE_URL#*@}"

RobeDevOps avatar Oct 18 '17 15:10 RobeDevOps

Do I need to assign this to someone?

RobeDevOps avatar Oct 19 '17 15:10 RobeDevOps

No, it'll get picked up when someone has time to look at it and test it out. We do have a bit of a change freeze as another PR needs to go in to insulate against change to this repository breaking things downstream.

nickdgriffin avatar Oct 19 '17 17:10 nickdgriffin

Ok, thank you, I just asked, I am new here so I do not know the process really well.

RobeDevOps avatar Oct 19 '17 17:10 RobeDevOps