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

run: add hello-broken sample #1480

Merged
merged 11 commits into from
Sep 23, 2019
Merged

run: add hello-broken sample #1480

merged 11 commits into from
Sep 23, 2019

Conversation

grayside
Copy link
Collaborator

@grayside grayside commented Sep 13, 2019

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.

Go variant: GoogleCloudPlatform/golang-samples#981

@grayside grayside requested review from fhinkel and grant September 13, 2019 21:13
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 13, 2019
Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

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

Requesting a few changes to the gcloud commands, README wording, and other nits.

RUN npm install --only=production

# Copy local code to the container image.
COPY . ./
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need a forward slash here.

Copy link
Collaborator Author

@grayside grayside Sep 18, 2019

Choose a reason for hiding this comment

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

While the previous practice was to use COPY . ., this is a newer practice I think we should use in COPY statements. The issue is COPY supports having multiple source arguments and one destination argument, but if the source arguments are:

  • A directory
  • More than one file

Then the destination needs to have the trailing slash otherwise it will error.

This is intended to future proof the use of the Dockerfile should a developer use it as a template.

run/hello-broken/README.md Outdated Show resolved Hide resolved
run/hello-broken/README.md Outdated Show resolved Hide resolved
run/hello-broken/test/deploy.sh Outdated Show resolved Hide resolved
run/hello-broken/test/runner.sh Outdated Show resolved Hide resolved
run/hello-broken/test/system.test.js Outdated Show resolved Hide resolved
@grayside
Copy link
Collaborator Author

Note the README here has a good amount of wording copied from other Run samples, I will revise all of them in follow-up to keep it in sync.

Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

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

LGTM. A few nits.

run/hello-broken/index.js Outdated Show resolved Hide resolved
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 0",
"e2e-test": "TARGET=Cloud test/runner.sh mocha test/system.test.js --timeout=20000"
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth it to just put this script as test so you may npm test instead of npm run e2e-test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Out of scope of this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, now that I see your point about npm test being a no-op, this bears some follow-up. I will file an issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've looked at the other samples that include script e2e-test in this repo as well as the cDPE test guide and squad notes.

If we consider this change out of scope, then I oppose adding this line then:

"test": "echo \"Error: no test specified\" && exit 0",

We do specify a test in this repo. We don't specify a config for specifying a test as the error suggests.

If we're going to add this script:

"e2e-test": ...

We should either consider using the Node way of npm test or fix the error message for npm test to be more accurate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

run/logging-manual/README.md Outdated Show resolved Hide resolved
run/logging-manual/README.md Outdated Show resolved Hide resolved
run/logging-manual/README.md Outdated Show resolved Hide resolved
This was referenced Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants