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

updated docs to show 'excludes' param #61

Merged
merged 1 commit into from
Apr 6, 2020

Conversation

AzySir
Copy link
Contributor

@AzySir AzySir commented Feb 21, 2020

Updated Documents to show the "excludes" parameter exists

@AzySir
Copy link
Contributor Author

AzySir commented Apr 4, 2020

@findkim Hey Kim, are we able to get this reviewed and merge if possible please!! - Thanks :)

@Spaider
Copy link

Spaider commented Apr 4, 2020

@AzySir documentation on excludes is rather concise. There are no examples on regex'es. E.g. I did not find a way to exclude the same dir on any nested level (__pycache__ for Python deployments).
Is there a way to achieve this?

Thanks

@AzySir
Copy link
Contributor Author

AzySir commented Apr 4, 2020

@Spaider what was the parameter you added - could you share some code?

@Spaider
Copy link

Spaider commented Apr 4, 2020

Here's zip archive definition for AppEngine package with Flask App, written in Python:

data "archive_file" "app_package" {
  type = "zip"
  source_dir = "../python/"
  output_path = "../.deploy/app.zip"
  excludes = ["__pycache__", ".DS_Store"]
}

This way it excludes only top-level __pycache__ directory but not the the directories with the same name but on nested levels down below.

@AzySir
Copy link
Contributor Author

AzySir commented Apr 4, 2020

Not sure on directories to be honest... Isn't pycache a folder?
Is the ".DS_Store" working?

Maybe try these?

excludes = ["__pycache__/*"]
excludes = ["./__pycache__"]

@Spaider
Copy link

Spaider commented Apr 4, 2020

Please disregard .DS_Store. It is a file with some macOS garbage.
Unfortunately, neither options for ignoring __pycache__ directory worked out.

@AzySir
Copy link
Contributor Author

AzySir commented Apr 5, 2020

@Spaider that's a fair use case. Unfortunately I don't have an answer for you - also I didn't design the functionality. I just created a documentation PR.

I think you want to keep an eye on these (and maybe raise your own) -

Here in issue #62 they are asking for a "**/.git" of set up.

I've asked the question in issue #63 if it's possible to do a "__ pycache __/*" arrangement (for a temporary work around) - however I think this is a feature that might need to be requested.

If you do request it - can you please tag me in it :)

@paultyng paultyng merged commit f8d8307 into hashicorp:master Apr 6, 2020
@raymondhardynike
Copy link
Contributor

raymondhardynike commented Apr 6, 2020

You can see some examples in the test. Glob/wildcards are not supported. I used to have full regex support when i first added excludes but was asked to change it to what it is today. It just uses relative paths. So you would have to list all of the sub dirs one at a time.

https://github.com/hashicorp/terraform-provider-archive/blob/master/archive/zip_archiver_test.go

@raymondhardynike
Copy link
Contributor

raymondhardynike commented Apr 6, 2020

It just checks if relname matches elements in the excludes list.
line 74 of zip_archiver.go

for _, exclude := range excludes {
		if exclude == "" {
			continue
		}

		if exclude == fileName {
			return true
		}
	}
	return false

@manasouza
Copy link

@AzySir and @Spaider please take a look at #57 if that could be of any help

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants