-
Notifications
You must be signed in to change notification settings - Fork 1.8k
run: add hello-broken sample #981
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
Conversation
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # [START run_broken_dockerfile] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Dockerfile is using the version workshopped in knative/docs#1774, let's finalize for this repo here and I'll send a follow-up to port the other Cloud Run samples.
run/hello-broken/Dockerfile
Outdated
| COPY . ./ | ||
|
|
||
| # Build the binary. | ||
| RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GOOS=linux is redundant i think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is redundant. Trying to decide if I want to lean in on explicit, add GOARCH, or rely on the defaults in the container and remove GOOS. Do you have thoughts here?
|
|
||
| os.Setenv("TARGET", "") | ||
| brokenHandler(rr, req) | ||
| os.Setenv("NAME", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something, but why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample demonstrates a brittle, low-visibility handling of an unset value, and a sane-defaults high visibility approach. I am testing the cases around both.
tbpg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but might want @broady to take another look if we're reusing the Dockerfile for other samples.
|
|
||
| // [START run_broken_service] | ||
|
|
||
| // Sample hello demonstrates a difficult to troubleshoot service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comment would be nice here. What is troublesome about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample is used in a tutorial where the reader is eventually given this answer, but a comment in the first code snippet would be counter-productive. Is there somewhere else I might add this detail?
|
@tbpg broady gave a verbal approval, merge at will. |
This adds a "broken" / difficult to troubleshoot sample for use in a troubleshooting tutorial.
This sample app is unusual in that it's is deliberately trying to show something not good as part of an exercise leading the developer through the full process of root cause analysis, fixing production, then improving the code.
Node.js (Canonical): GoogleCloudPlatform/nodejs-docs-samples#1480