jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
534 stars 233 forks source link

Cannot exclude files during terraform module publish #2593

Open cdivitotawela opened 4 months ago

cdivitotawela commented 4 months ago

Describe the bug

Using following command to publish a terraform module and want to exclude .git and .github directories. Published module zip file contains the excluded directories. jf terraform publish --namespace mynamespace --provider azurerm --tag 'v0.0.8' --exclusions "\*.git\*"

Tried different options --exclusions '.git;.github' and none seems to be working.

I can see DEBUG logs indicate it ignored .git directory but it is still included.

09:30:50 [Debug] Sending HTTP GET request to: https://mynamespace.jfrog.io/artifactory/api/system/version
09:30:50 [Debug] The path '/Users/***/github/***/***/.DS_Store' is excluded
09:30:50 [Debug] The path '/Users/***/github/***/***/.git' is excluded

Following instruction in https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli/cli-for-jfrog-artifactory/package-managers-integration#terraform-publish example 2

Current behavior

Cannot exclude files using --exclusions when publishing terraform module

Reproduction steps

  1. Create a simple terraform module in a git repository and run following command to exclude the .git folder jf terraform publish --namespace mynamespace --provider azurerm --tag 'v0.0.8' --exclusions "\*.git\*"
  2. Check the zip file content in Artifactory portal and .git folder is included in the zip file

Expected behavior

Any file, directory added in --exclusions argument must be excluded from the zip file uploaded to Artifactory

JFrog CLI version

jf version 2.56.0

Operating system type and version

OSX

JFrog Artifactory version

Cloud

JFrog Xray version

No response

loshea-bmcd commented 3 months ago

Having the same issue. Trying to eclude .git, .github, .terraform. The only thing that works is using , which, in our use case, excludes things we intend to keep in a couple of cases

gchappel commented 2 months ago

Same issue here - my intended workaround is to use rsync to copy the directory to somewhere else but excluding the files I don't want, and then using jf to upload the temporary directory which has already been sanitised. But this is a frustrating bug, especially since the documentation states explicitly that this is possible in the last paragraph.