Automatic SCM configuration not working?

We are trying to set up automatic SCM application configuration.

According to the documentation, when this is enabled, when a nexus-iq-cli scan is done, the SCM for that application should be auto-configured, which is not happening.

The organisation is created, the BitBucket SCM and credentials are configured and working on the on organisation level. If the application SCM url is configured manually for that application, it works fine. However, when it’s not filled, after nexus-iq-cli scan it’s not populated with the discovered git repository url.

Hey Radek,

Thanks for posting. This looks like it is best serviced by our support team. Please submit a ticket in the support portal and they can help debug what is going wrong with the auto configuration.

Cheers!
Justin Young
Director, Product Management

1 Like

I have managed to resolve this issue by checking the -X debug from nexus-iq-cli.
The problem was in how Bamboo CI system is checking out the git reposity. In the logfile I could see:

build	[INFO] Discovered repository url 'file:///home/bamboo/build-dir/..........' via jGit
build	[DEBUG] Amending source control record for application with id: X  with discovered repository URL

build	[DEBUG] Making external request: POST https://hostname/api/v2/sourceControl?publicId=X&repositoryUrl=file:%2F%2F%2Fhome%2Fbamboo

As you see, the discovered git remote is using file:/// instead of https:// and that causes the nexus-iq-cli not setting the SCM repository correctly. The workaround is to run in your CI a curl request with the above parameters and repositoryUrl set correctly to https.

Example command:

curl -u user -G --request POST --data-urlencode "publicId=appId" --data-urlencode "repositoryUrl=https://path/to/repo.git" https://hostname/api/v2/sourceControl