Jenkins Artifactory plugin - grabbing latest artifacts

Matt

I am trying to save build artifacts and pull them into new builds via the upload/download spec portion of the Jenkins Artifactory plugin. Is there a way to grab the "latest" build artifacts?

I see in the Artifactory file spec docs that there should be a "build" element in the download spec where I can specify "LATEST" but that doesn't work, just says "LATEST" not found. Maybe I am not publishing my builds to Artifactory correctly in the first place?

According to this SO question and this GitHub page it appears that sorting by date and grabbing the newest is only supported with the jfrog CLI and not in Jenkins. Others told me that this sort of functionality can be had using the name setter, version number, description setter plugings... but that seems really hacky.

We are using Jenkins 2.60.3 and Artifactory Enterprise 5.4.5.

Matt

I could not get this to work at all if I was using "aql", but it works when using "pattern" to find the file(s). When "build" is specified it will grab that build's artifacts only, even if the repo you're pointing at has a bunch a similarly named files (the build metadata in Artifactory takes care of this I guess). Without specifying "build" it would grab all of the matching artifacts.

"build" should be in the build-name/build-number format, but you can leave off the number OR use LATEST in order to grab the latest successful build's artifacts (I tested this by creating a failed build).

Example to illustrate:
- This will download file3 to Dependencies/file3
- Removing "/LATEST" will also download only file3
- Removing the whole "build" line will download all 3 files

# Artifactory Repo: example-repo/  
# BuildName: example-build
#   example-repo/file1  (from build 1)   
#   example-repo/file2  (from build 2)   
#   example-repo/file3  (from build 3)

Download File Spec:
{
    "files": [
        {
            "pattern": "example-repo/file*",
            "target": "Dependencies/",
            "recursive": "false",
            "flat" : "true",
            "build" : "example-build/LATEST"
        }
    ]
 }

For more info, see the build keyword in JFrog File Specs document https://www.jfrog.com/confluence/display/RTF/Using+File+Specs

build [Optional]

If specified, only artifacts of the specified build are downloaded. The 'pattern' property is still taken into account when 'build' is specified. The property format is build-name/build-number. If the build number is not specified, or the keyword LATEST is used for the build number, then the latest published build number is used.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Jenkins Artifactory Plugin

Jenkins and JFrog Artifactory - artifacts are not deleted after "maxBuilds"

Jenkins Artifactory Plugin not working with recent Artifactory version

Jenkins artifactory plugin - identify that files are not there

Fail Jenkins build when zero artifacts uploaded into artifactory

Error while publishing the artifacts to Artifactory using Jenkins Pipeline Script

JFrog Artifactory artifacts uploaded via jenkins dont show up in builds

Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?

Can not push Docker Image to Artifactory in Jenkins pipeline using Artifactory plugin

Artifactory plugin for Jenkins Pipeline saving files in Artifactory like folder structure

Jenkins Artifactory Plugin File Specs with subprojects

rtMavenRun() artifactory plugin not using credentials configured in jenkins

Jenkins Artifactory Plugin vs. Maven

Jenkins Artifactory Plugin ignoring Maven UniqueVersion

Jenkins Artifactory plugin - upload from shared library

Jenkins Artifactory plugin not generating POM file

Jenkins Artifactory plugin: Is there a way to specify a replacement POM?

How to deploy shadow jar with jenkins artifactory plugin

deploy build to artifactory via cli or jenkins plugin

Overwriting Artifactory artifacts (and history)?

Upload artifacts to artifactory with python

Uploading artifacts to JFrog Artifactory

How to copy subdirectories artifacts by jenkins Copy Artifact Plugin

How to deploy artifacts to Maven Repository (JFrog artifactory) through Jenkins Build Offline?

How to deploy an artifact from group of artifacts to jfrog artifactory using jenkins post build action

NPE in Jenkins with latest version of Slack Notification Plugin

artifactory jenkins plugin with first class nuget support like maven packages

How to avoid a Conan SSL user authentication error with Jenkins Artifactory plugin?

Jenkins Artifactory Release Plugin Unable To Commit Tag (Windows Host Machine)

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive