Skip to content

Downloading the latest artifact #96

Description

@ebranecky

Hey Guys,

I am currently trying download the latest artifact in our artifactory repo and am having some issues. One method I have tried is calling the Artifact.latest_version method to get the version number and then do a property_search for this version number. I keeping getting a nil response on the latest version which causes the search to not work as well. Another method I tried was doing a search on the artifact name and repo and doing a get last on that. This method returns unexpected artifacts. Am I supposed to be sending an sort option and if so what does that look like. Any help would be greatly appreciated on what the best method for acquiring the latest artifact is.

Search by version
artifactVersion = Artifactory::Resource::Artifact.latest_version(name: 'TestArtifact', group: 'app.group', repos: 'local')
artifact = Artifactory::Resource::Artifact.property_search(name: 'TestArtifact' ,repos: 'local', version: artifactVersion ).first
artifact.download(@target_directory, filename: @file_name)

Search on name
artifact = Artifactory::Resource::Artifact.search(name: 'TestArtifact' ,repos: 'local').last
artifact.download(@target_directory, filename: @file_name)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions