Accenture / adop-platform-management

Apache License 2.0
60 stars 60 forks source link

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

Open RobeDevOps opened 7 years ago

RobeDevOps commented 7 years ago

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 commented 7 years ago

Do I need to assign this to someone?

nickdgriffin commented 7 years ago

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.

RobeDevOps commented 7 years ago

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