Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ANT patterns when uploading #918

Closed
mariakoleva opened this issue Dec 7, 2020 · 9 comments
Closed

Using ANT patterns when uploading #918

mariakoleva opened this issue Dec 7, 2020 · 9 comments
Labels
feature request New feature or request

Comments

@mariakoleva
Copy link

We have a use case to upload parts of a directory tree to Artifactory by excluding and including files and directories using ANT patterns. We need to provide a way to our users to specify multiple ANT patterns to be excluded from their upload and multiple ANT patterns to be the only files/directories included in their upload.

I'd like to see an option on the upload JFrog CLI command similar to the --exclusions option but supporting ANT patterns instead of regular expressions. I'd also like to see a similar --inclusions option that works with ANT patterns.

At the moment we are doing pattern matching ourselves, before creating a compressed archive of the directory tree and passing that to the JFrog CLI upload command. However, we are seeing bad performance with this implementation and think this can be sped up if it was implemented as part of the JFrog CLI command.

This is related to issue #867 - that is the other feature request needed for the same use case.

@mariakoleva mariakoleva added the feature request New feature or request label Dec 7, 2020
@eyalbe4
Copy link
Contributor

eyalbe4 commented Dec 7, 2020

@mariakoleva,

Thanks for sharing this requirement!
Have you tried using the jfrog rt u command without regular expressions, meaning without the --regexp option? If you don't use this option, the command expects patterns which are very similar to ANT patterns. I believe that if you send an ANT pattern to the command, it will work as expected. This is because the double asterisk syntax of ANT patterns works seamlessly with the wildcards patent accepted by JFrpg CLI.

Would you like to try it out and let us know?

@mariakoleva
Copy link
Author

mariakoleva commented Dec 8, 2020 via email

@eyalbe4
Copy link
Contributor

eyalbe4 commented Dec 8, 2020

Hi @mariakoleva,

For passing multiple include patterns for the jfrog rt upload command , I recommend using File Specs. See Example 4: Upload, which uploads files to Artifactory from two different local paths. You can then pass the file spec path to the command using the --spac option.

As for the example you showed, in which you provided the “**/dir/**/*.txt” pattern, this is actually one of the ways ANT patterns differ from plain wildcard patterns. Changing the pattern you provided to either “dir/*.txt” or “*dir/*.txt” will match "dir/a.txt". And if you need to be more specific, you can provide multiple patterns.

Please let me know if this helps.

@mariakoleva
Copy link
Author

Hi,

Thank you for your reply. I haven't tried file specs but they look useful for passing in multiple patterns. I suppose this feature request can be amended to a request to support ANT patterns in file specs.

Unfortunately, changing from ANT patterns to plain wildcard patterns is not an option for us. We have a large number of CI jobs using ANT patterns which we are switching over to Artifactory. It's not feasible to change all of them to wildcard patterns.

Thanks,

Maria

@eyalbe4
Copy link
Contributor

eyalbe4 commented Mar 21, 2021

@mariakoleva,
The latest release of JFrog CLI adds a new --ant option to the jfrog rt u command.
Looking forward to your feedback for it.

@mariakoleva
Copy link
Author

Hi @eyalbe4,

Thank you for adding this! I finally had the chance to test the new --ant option. I tested 25 use cases with it, and only found a few issues. I've raised all of those as support tickets already but I'm happy to share the ticket numbers with you if that will be helpful.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Apr 29, 2021

Thank you for the feedback @mariakoleva!
We'll happily add improvements and fixes following the support investigation.

@enaess
Copy link

enaess commented Jun 2, 2023

As am trying this, is there support for variable matching too, e.g.

{
  "files": [
    {   
      "pattern": "target/build/**/{file:\\w}*.jar",
      "target": "some/path/{file}.jar,
      "ant": true
    }
}

@shuvadipc
Copy link
Collaborator

supporting ANT patterns when uploading is already supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants