40001

How to create folders dynamically and upload artifacts in Jfrog artifactory using filespecs in Jenki

I have a build job in jenkins which builds the project from github for any branch. package will be created in build job workspace with the version as xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

My next artifactory push job has filespec written as below:

{ "files": [ { "pattern": "/var/lib/jenkins/workspace/Jobname/target/*/xxxx-yyyyy*.zip", "target": "libs-snapshot-local/xxxx-yyyyy/", "recursive": "false" } ] }

Above filespec recognize the pattern and upload the zip in libs-snapshot-local/xxxx-yyyyy/. But I need to upload the file with folder created with version name available on the zip file xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

Can anybody help me to create a folder dynamically with version name? any idea on how to specify target path in filespec?

Answer1:

The file specs has the ability to use placeholders in order to create more flexible paths. For example in your case:

{ "files": [ { "pattern": "/var/lib/jenkins/workspace/Jobname/target/*/(xxxx-yyyyy*).zip", "target": "libs-snapshot-local/{1}/", "recursive": "false" } ] }

Please pay attention for the parentheses in the pattern and the placeholder marker {1} used in the target.

Recommend

  • How to export a table in access to CSV with dot in field names through VBA?
  • How to show output for file operations performed by Perforce API?
  • How to manage artifactory / maven artifact using different profiles
  • How can I provide SBT credentials to my private Artifactory server from a Windows workstation?
  • Compiling RInside program with g++ on Linux
  • Getting “Not logged on in interface XBP” error when calling XBP function module via sap .net connect
  • Running Talend child jobs through a parent job
  • gradle.buildStarted not triggered
  • Is there a way to force quotation of numbers in JSON 1.x Perl module?
  • Google chart horizontal scrollbar
  • Bitbucket Build Erring after triggered from Commit
  • Referencing external dependencies in GGTS by convention
  • Furthest-point Voronoi diagram in Java
  • Why is `;;` giving me a syntax error in utop?
  • smarty nested if condition is not working properly?
  • LINQ join with filter criteria
  • Eloquent Relationship on Partial Match
  • Is there any way to call saveCurrentTurnWithMatchData without sending a push notification?
  • Double dispatch in Java example
  • Angular Bootstrap Carousel Slide Transition not working correctly
  • XMLBeans Duplicate Class and Class Not Found Errors
  • can variables be set randomly when declaring them again?
  • Other than Linq to SQL does anything else consume INotifyPropertyChanging?
  • NSIS decompiler
  • Get the number 18437736874454810627
  • Suqueries in select clause with JPA
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Insert new calendar with SyncAdapter- Calendar API Android
  • error importing numpy
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Ensure fsync did its job
  • Very simple C++ DLL that can be called from .net
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • using HTMLImports.whenReady not working in chrome
  • Authorize attributes not working in MVC 4
  • EntityFramework adding new object to nested object collection
  • How can i traverse a binary tree from right to left in java?
  • How to push additional view controllers onto NavigationController but keep the TabBar?