Search code examples
gradleartifactory

Is The Gradle Artifactory Plugin Supposed To Use A Plain Text Or Encrypted Password?


When I click "Set Me Up" in Artifactory is generates a gradle.properties file something like this:

artifactory_user=my_artifactory_user
artifactory_password=WAklvc9LXWDsVcoVILbKyebkQG5uBxos6rIrmi8HjMTB3xicLJbxstmEQwRwIoGN6pBnK3T91I
artifactory_contextUrl=https://artifactory.company.com/artifactory

However, when I run ./gradlew artifactoryDeploy I get this error:

> Task :artifactoryDeploy FAILED    
Could not build the build-info object.    
org.jfrog.build.util.VersionException: Error occurred while requesting version information:  Response message: {    
  "errors" : [ {    
    "status" : 401,    
    "message" : "Bad credentials"    
  } ]    
}

...
stacktrace
...

FAILURE: Build failed with an exception.
* What went wrong:    
Execution failed for task ':artifactoryDeploy'.    
> java.io.IOException: Could not publish build-info: Error occurred while requesting version information:  Response message: {    
    "errors" : [ {    
      "status" : 401,    
      "message" : "Bad credentials"    
    } ]    
  }

I'm confused because Artifactory is generating this encrypted password but the docs use an example with plain text. https://www.jfrog.com/confluence/display/JFROG/Working+With+Gradle#WorkingwithGradle-ConfiguringGradle

Is the artifactory_password supposed to be encrypted like this or is it supposed to be plain text?


Solution

  • The artifactory_password parameter can be used for:

    • clear text passwords
    • encrypted passwords
    • API key

    If you are getting a Bad credentials error, one of the possible reasons is using an encrypted password when Artifactory is configured with Password Encryption Policy set to Unsupported (not respecting encrypted passwords).
    A few things you can do to debug this issue:

    • Verify the Password Encryption Policy is set to Supported or Required (requires admin) in Administration -> Security -> Settings
    • Test the user and password by trying to call the REST API using a client such a cURL. Make sure you use an API method which requires and authenticated user