Cannot exclude files during terraform module publish
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
- 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\*" - 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
Having the same issue. Trying to eclude .git, .github, .terraform. The only thing that works is using
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.
Hey @cdivitotawela,
I attempted to reproduce the issue using JFrog CLI version 2.56.0 as well as the latest version (2.73.3), and the --exclusions flag appears to be working as expected for me.
Steps Taken:
-
Environment Setup:
Created a directory structure with
.gitand.githubfolders. Added placeholder files inside these directories. -
Commands Used:
jf terraform-configto configure the Terraform project.JFROG_CLI_LOG_LEVEL=DEBUG jf terraform publish --namespace=mynamespace --provider=azurerm --tag='v0.0.8' --exclusions='*.git*;*.github*'to publish the module while excluding certain directories. Results: Published an artifact namedv0.0.8.zip. Examined the contents of the ZIP file and confirmed that the excluded directories (i.e., .git and .github) were not present.
Directory Structure Created:
Contents of the ZIP File:
Observations and Insights:
I noticed that using --exclusions='\*.git\*' with backslashes did not work, whereas --exclusions='*.git*' without backslashes worked correctly. According to the JFrog CLI documentation, a list of semicolon-separated exclude patterns is supported, which allows using wildcards.
Documentation Reference: You can exclude files and directories from being scanned by the commands using the --exclusions option. For example:
jf terraform publish --namespace=example --provider=aws --tag=v0.0.2 --exclusions="*test*;*ignore*"
Request for Clarification:
- Could you please let me know if this issue still persists on your end?
- Are there any specific steps or configurations I might be missing that could be contributing to the discrepancy?
Thanks!
Closing this issue. Feel free to reopen if the issue still persists.