Thread-safe upload/download
Closed this issue · 1 comments
Is there really no thread-safe way to upload an artifact?
I don't see a methods that allow me to upload an artifact to a specific repo on remote.
puts @client.methods
artifact_search
artifact_gavc_search
artifact_property_search
artifact_checksum_search
artifact_versions
artifact_latest_version
artifact_from_hash
repository_all
repository_find
user_all
user_find
# ...
So as a workaround, I can simply find
the remote repo by name, and upload to it.
# NOTE: Execute all requests using client object to remain thread-safe
# https://github.com/opscode/artifactory-client#threadsafey
@client = Artifactory::Client.new(
endpoint: MyGem::Constants::ARTIFACTORY_ENDPOINT ,
username: @username ,
password: @password)
...
repo = @client.repository_find("libs-release-local")
repo.upload("mygem-1.2.3.jar", "remote/path/to/store/artifact")
But this has a problem, that means I need to set my uploader
account as an admin according to this Artifactory REST API doc:
https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RepositoryConfiguration
Requires a valid user for a shared remote repository and admin user for anything else. Shared remote repository data is sanitized for security when a non-admin user is used.
@xbeta yea, this is definitely a problem. When we wrote this gem, we didn't really take the different permissions into account; we just assumed everyone had admin permissions. As part of our upcoming work, we are going to refactor this to solve your issue.
- We are going to move the artifact uploading object onto the
#<Artifact>
class, accepting a repo key as a parameter - Delegate the
Repository#upload
functionality to this new method
I've labeled this as a bug, and we will fix this in our upcoming work. We'd also gladly review a pull request for this functionality if you're able to get to it before our team has a chance to.