I am trying to upload multiple patterns like .zip and .tar.gz using Artifactory/Jfrog Files in Jenkins.
here is my code
def uploadSpec = """{
"files": [
{
"pattern": "(*.zip | *.tar.gz)",
"target": "${upload_loc}/${BRANCH_NAME}/",
"recursive": "true",
"flat": "false",
"props": "Version=${Version};Branch=${BRANCH_NAME}"
}
]
}"""
I tried above syntax and it's not working for me, it says 0 artifcats found. can any one suggest if they encounter similar scenario.
Thanks and Regards Saint
Here are four different ways to push JAR files to a JFrog Artifactory repository. 1. Upload to the Artifactory repository manually
For example, to pull Artifactory every ten minutes, set */10 * * * * 4. Set a Path to watch. For example, when setting generic-libs-local/builds/starship, Jenkins polls the /builds/starship folder under the generic-libs-local repository in Artifactory for new or modified files.
For organizations in pursuit of DevOps enlightenment, it's the CI/CD build that should be pushing packaged artifacts to an Artifactory repository. Fortunately, JFrog provides a Jenkins Artifactory plugin that facilitates automation of the process.
Setting Up the Integration 1 Open the JFrog Piplines UI. 2 Under Integrations, click on the Add an Integration button. 3 Choose Jenkins Server integration type and fill out all of the required fields. 4 Click on the Generate button to generate a token. This token is used by Jenkins to authenticate with JFrog Pipelines.
You have 2 options:
Option 1 - Use a regular expression to describe your patterns.
In your example something like this should work:
...
"pattern": "(.*\.zip|.*\.tar\.gz)",
"regexp":"true",
...
Note that if you do so, you have to add the flag regexp=true.
(I use this website to test my expressions. note that you have to check golang as your flavor)
Option 2 - Use multiple files in a single spec (what I would probably do in your case).
In your example something like this should work:
..."files": [
{
"pattern": "*.tar.gz",
"target": "${upload_loc}/${BRANCH_NAME}/",
"recursive": "true",
"flat": "false",
"props": "Version=1"
},
{
"pattern": "*.zip",
"target": "${upload_loc}/${BRANCH_NAME}/",
"recursive": "true",
"flat": "false",
"props": "Version=1"
}
]...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With