Skip to content

tiltfile: add only parameter to docker_build#1711

Merged
jazzdan merged 4 commits into
masterfrom
dmiller/ch2685/implement-only-parameter
Jun 5, 2019
Merged

tiltfile: add only parameter to docker_build#1711
jazzdan merged 4 commits into
masterfrom
dmiller/ch2685/implement-only-parameter

Conversation

@jazzdan

@jazzdan jazzdan commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

No description provided.

@jazzdan
jazzdan requested review from dbentley and maiamcc June 5, 2019 17:39
f.dockerfile("Dockerfile")
f.yaml("foo.yaml", deployment("foo", image("gcr.io/foo")))
f.file("Tiltfile", `
docker_build('gcr.io/foo', '.', ignore="**/*.md", only=["common/**", "myservice/**"])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other weird interactions I should add tests for here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are probably a bunch. It would be good to say in the docs that only is built on dockerignore, and so may have issues.

What if you put the same file in both ignore and only?

What if you have elements that start with ! in only?

What if you have \n in strings?

I'm not sure it's worth trying to catch all of these right now, vs. being clear that if you need to be extremely dlever you should talk to us.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh these are great. I'm going to add some tests for them, and make myself a TODO to write up some docs about precedence rules and such.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For things that don't block this epic, but we should do, it can be better to leave it as a TODO in code than in your notebook so that if you end up working on something else, your thoughts can help the next person to take it up.

@dbentley dbentley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to match the filter that's created, but not the end-to-end "this Tiltfile plus an edit to this file does/does not end up in the context"

@jazzdan

jazzdan commented Jun 5, 2019

Copy link
Copy Markdown
Contributor Author

@dbentley that's true and I think that would be the job of a test in the build/container test suite.

My instinct would be to put that in a separate PR.

@dbentley

dbentley commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

Fine with another PR; it seems like important testing to have some version of before closing this epic

@dbentley

dbentley commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

The build/container wouldn't include the Tiltfile piece, right?
I'm thinking end-to-end means being able to write a test like:

f.tiltfile("docker_build('foo', '.', only=['foo'])")
f.assertInContext('foo/main.go')
f.assertNotInContext('bar/main.go')

@dbentley dbentley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed aloud, I was missing that these tests already include evaluating the matcher against a path.

@jazzdan
jazzdan merged commit 31766e7 into master Jun 5, 2019
@nicks
nicks deleted the dmiller/ch2685/implement-only-parameter branch February 3, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants