Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting authentication error using maven-release-plugin

We are attempting a release in Bamboo using Maven. The maven-release-plugin creates a tag in Subversion and uploads a artifact to the Nexus release repo. Both Nexus and Subversion can authenticate with the same user. We are storing that users credentials in our settings.xml.

When we run this release process from my laptop the process works fine.

When we run the process from Bamboo the process fails with an authentication error in Subversion. Nexus has no problems authenticating.

When we pass in the same user's credentials using the "-D" parameters the process works fine.

Does anyone know why there is a problem using the encrypted credentials from the settings.xml file?

We are using Bamboo v5.15

2 answers

1 accepted

0 votes
Answer accepted

I believe the answer to this issue can be found at the below link. It is an issue with the Maven Release Plugin, not Bamboo.

http://maven.apache.org/maven-release/maven-release-plugin/faq.html#credentials

You add the the project.scm.id property to the POM file and set the property to a server id in Bamboo's setting.xml file. I used the same credentials that Maven uses for the Releases repository since that user exists in both my Nexus and Subversion repositories.

By setting this property the release plugin automatically knows to use the server credentials for committing code into Subversion. I plan on setting this property in a parent POM. That way the developers do not need to worry about including it and there is no extra setup when creating a release job in Bamboo.

<project>
   ...
    <properties>
      <project.scm.id>my-scm-server<project.scm.id>
    </properties>
  </project>

One note -- I discovered an issue on Windows if the password contains special characters. Subversion did not handle the special characters very gracefully and the job failed. Luckily our Bamboo instance runs on a Linux server and the special character does not cause any problems on Linux.

0 votes
robhit Atlassian Team Apr 23, 2018

Hi Chris,

What exactly the error is thrown in the logs?

Also, Could you check what user is used for starting the Bamboo?

I should have added this to start with, thank you for the follow up.

The error message is below and appears to be coming from Subversion:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project my-api: Unable to commit files
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option
[ERROR] svn: E215004: Commit failed (details follow):
[ERROR] svn: E215004: Unable to connect to a repository at URL 'https://mycompany.com/repo/my/app/my-api/trunk'
[ERROR] svn: E215004: No more credentials or we tried too many times.
[ERROR] Authentication failed

The user running Bamboo is different than the user in the settings.xml file which is what should be used for Nexus and Subversion.

Hi @robhit,

Have you had any time to consider a solution to my problem? Thanks in advance for any help you can offer.

robhit Atlassian Team May 09, 2018

 

Hi @Chris Flynn,

Since this works locally, could you try to execute the same command using the user used to run the bamboo or the remote agent?

That is an excellent suggestion. I will try this and report back the results.

Hi @robhit

That was an excellent suggestion! Thank you for the help.

I was able to replicate the same problem we are experiencing in Bamboo on my local system and I now know why the problem is happening, although I don't know how it could be permanently fixed.

Results from the test:

  1. The release plugin deploys artifacts with the credentials in the settings.xml file
  2. The release plugin commits changes to Subversion using the credentials used to check out the code
  3. [REALIZATION] -- I thought the release plugin used the credentials from the settings.xml for both the artifact deployment and the Subversion commit. This was an incorrect assumption!
  4. Two pieces of background information
    1. The release plugin appears to run svn --non-interactive commit to commit changes back into Subversion
    2. I use TortoiseSVN to checkout the code from Subversion.
  5. When TortoiseSVN saves the credentials used to checkout the code the release process completes successfully
  6. When TortoiseSVN does not save the credentials used to checkout the code the release process fails with the above error message
  7. [CONCLUSION] Bamboo does not save the credentials it uses to checkout the code in a way that they can be reused by the Subversion CLI utility.

For now we are passing the credentials in for each job running a release, however, ideally I would like to be able to reuse the credentials already setup in Bamboo when setting up the linked repository.

Hi @Chris Flynn,

How is your Bamboo configured to start? Are you using Windows Service to start your Bamboo? If you are using Windows service ensure that a local user account is used for the same.

See below document:

https://confluence.atlassian.com/bamboo/running-bamboo-as-a-windows-service-as-the-local-user-416580754.html

Thanks,

Robhit

Our Bamboo instance is running on a Linux server. There is a local account on the server that we use to start Bamboo.

Why does it matter how Bamboo is running? Or which account is running Bamboo?

We created linked repositories in Bamboo and provided Subversion credentials in the configuration for each linked repository. Bamboo uses the linked repository and the configured credentials to checkout code from Subversion.

@robhit -- thank you very much for your help. I believe I discovered a fix below.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

587 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you