Skip to content

service/samples: add .dockerignore to samples with local build disruption risk#1392

Merged
knative-prow-robot merged 6 commits into
knative:masterfrom
grayside:hello-dockerignore
May 31, 2019
Merged

service/samples: add .dockerignore to samples with local build disruption risk#1392
knative-prow-robot merged 6 commits into
knative:masterfrom
grayside:hello-dockerignore

Conversation

@grayside
Copy link
Copy Markdown
Contributor

Problem

  1. If someone runs a local build in these samples, it will generate files that will make their way into the container. Once there, these files can interfere with the build.

  2. Files unrelated to the application itself such as the Dockerfile or README.md can excessively reset the layer cache.

Proposed Changes

  • Add a new .dockerignore for serving samples subject to (1), with language-specific exclusions of generated files. This includes: Python, C#, PHP, Nodejs
  • Add Dockerfile and README.md for (2)
  • Include a new step in the README after the Dockerfile is set up to note creating the .dockerignore.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 29, 2019
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 29, 2019
@grayside
Copy link
Copy Markdown
Contributor Author

/cc @steren

@knative-prow-robot knative-prow-robot requested a review from steren May 29, 2019 22:47
@RichieEscarez
Copy link
Copy Markdown
Contributor

the _index.md file in each folder is for the website build, does that need to be ignored too?

@grayside
Copy link
Copy Markdown
Contributor Author

That's a fantastic question Richie. In the interests of making this a light touch (it borders on going too far for a helloworld/quickstart), my take is that we should not include _index.md or other elements of the knative/docs repo itself.

If we find there are real performance gains to be had, we can patch in some additional .dockerignore lines as part of the CI process.

CMD ["dotnet", "out/helloworld-csharp.dll"]
```

1. Add a `.dockerignore` file to ensure local builds cannot disrupt container builds.
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.

Why tell folks to add a .dockerignore file since you added it already. If they clone the source code they will have the file already there.

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.

We don't tell them to clone the source code, we tell them to assemble the files through CLI scaffolding and copy & paste.

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.

Suggested change
1. Add a `.dockerignore` file to ensure local builds cannot disrupt container builds.
1. Create a `.dockerignore` file to ensure that any files related to a local build, do not affect the container that you build for deployment.

Can we make this change throughout?

Copy link
Copy Markdown
Contributor

@RichieEscarez RichieEscarez left a comment

Choose a reason for hiding this comment

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

One global change requested, otherwise looks good to me.

@grayside
Copy link
Copy Markdown
Contributor Author

One global change applied.

Copy link
Copy Markdown
Contributor

@RichieEscarez RichieEscarez left a comment

Choose a reason for hiding this comment

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

/approve

Looking for an LGTM from a SME, please

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grayside, RichieEscarez

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

One question on grammar that I'm not sure about, and a request whether technical assistance is available.


1. Create a `.dockerignore` file to ensure that any files related to a local build, do not affect the container that you build for deployment.

```ignore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@RichieEscarez

Is there any way to do some fancy server-side include magic here rather than needing to repeat the content?

Copy link
Copy Markdown
Contributor

@RichieEscarez RichieEscarez May 30, 2019

Choose a reason for hiding this comment

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

for the rendered content on the site, yes we have a few options (ie. using Hugo variables to inject chunks of content). the downside is that when the content is viewed in GitHub, its no longer legible (more difficult for authors or one-off contributors, especially those who use the GitHub WYSIWYG UI). im toying with the idea of getting our Netlify builds to run on demand (therefore the authoring process / PR review and merge steps would include running a "test build" to render and verify the output) but that too adds to the overhead of contributing. I think the first place we want to start to implement "content reuse" and "single sourcing" are for the multiple install guides

we should chat more if you have ideas here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for the rendered content on the site, yes we have a few options (ie. using Hugo variables to inject chunks of content). the downside is that when the content is viewed in GitHub, its no longer legible (more difficult for authors or one-off contributors, especially those who use the GitHub WYSIWYG UI). im toying with the idea of getting our Netlify builds to run on demand (therefore the authoring process / PR review and merge steps would include running a "test build" to render and verify the output) but that too adds to the overhead of contributing. I think the first place we want to start to implement "content reuse" and "single sourcing" are for the multiple install guides

we should chat more if you have ideas here?

I would like something like SSI Include syntax:

<!--#include file="included.html" -->

Which seems like it would be fairly natural to read. But I don't know if Hugo has that capability.

Comment thread docs/serving/samples/hello-world/helloworld-php/README.md Outdated
@knative-prow-robot knative-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels May 30, 2019
Comment thread docs/serving/samples/hello-world/helloworld-csharp/README.md Outdated
Comment thread docs/serving/samples/hello-world/helloworld-nodejs/README.md Outdated
Comment thread docs/serving/samples/hello-world/helloworld-python/README.md Outdated
Co-Authored-By: RichieEscarez <rescarez@google.com>
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label May 30, 2019
grayside and others added 3 commits May 30, 2019 16:05
Co-Authored-By: RichieEscarez <rescarez@google.com>
Co-Authored-By: RichieEscarez <rescarez@google.com>
Co-Authored-By: Evan Anderson <evan.k.anderson@gmail.com>
@googlebot
Copy link
Copy Markdown

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels May 30, 2019
@grayside
Copy link
Copy Markdown
Contributor Author

Comma extraction is complete. Thanks for using the suggestion feature!

@evankanderson
Copy link
Copy Markdown
Member

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 31, 2019
@evankanderson evankanderson added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels May 31, 2019
@googlebot
Copy link
Copy Markdown

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@evankanderson
Copy link
Copy Markdown
Member

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 31, 2019
@knative-prow-robot knative-prow-robot merged commit 0d5b492 into knative:master May 31, 2019
RichieEscarez pushed a commit to RichieEscarez/docs that referenced this pull request Jun 6, 2019
…tion risk (knative#1392)

* service/samples: add .dockerignore to samples with risk of local build interference

* serving/samples: .dockerignore readme text update

* Update docs/serving/samples/hello-world/helloworld-csharp/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-nodejs/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-python/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-php/README.md

Co-Authored-By: Evan Anderson <evan.k.anderson@gmail.com>
knative-prow-robot pushed a commit that referenced this pull request Jun 7, 2019
* pr#1408

* pr#1398

* service/samples: add .dockerignore to samples with local build disruption risk (#1392)

* service/samples: add .dockerignore to samples with risk of local build interference

* serving/samples: .dockerignore readme text update

* Update docs/serving/samples/hello-world/helloworld-csharp/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-nodejs/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-python/README.md

Co-Authored-By: RichieEscarez <rescarez@google.com>

* Update docs/serving/samples/hello-world/helloworld-php/README.md

Co-Authored-By: Evan Anderson <evan.k.anderson@gmail.com>

* Fix the wrong information in grpc example (#1380)

* pr#1363

* Fix samples path (#1357)

* Copy the updates from knative/eventing#1241. (#1355)

* add reference to custom DNS config (#1327)

* add reference to custom DNS config

* Update docs/install/getting-started-knative-app.md

Co-Authored-By: Sam O'Dell <31352624+samodell@users.noreply.github.com>

* fix relative link

* Fix PR#1202

* Document serving tag resolution (#1260)

Our controller does resolution of tags to digests, which has been a
source of confusion. This documents the fact that we do it, why we do
it, and how to configure the controller to work around common issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants