Skip to content

chore: keep docs/admin/prometheus.md if make target fails #5284

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

Closed
wants to merge 3 commits into from

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Dec 5, 2022

Spotted in: https://github.com/coder/coder/actions/runs/3617487847/jobs/6096383996

Run make --output-sync -j -B gen
  make --output-sync -j -B gen
  shell: /usr/bin/bash -e {0}
fatal: No names found, cannot describe anything.
yarn run v1.[2](https://github.com/coder/coder/actions/runs/3617487847/jobs/6096383996#step:14:2)2.19
$ prettier --write 'src/api/typesGenerated.ts'
src/api/typesGenerated.ts 598ms
Done in 0.90s.
make: *** Deleting file 'docs/admin/prometheus.md'
yarn run v1.22.19
$ prettier --cache --check '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'
Checking formatting...
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[warn] src/api/typesGenerated.ts
[warn] Code style issues found in the above file. Forgot to run Prettier?
error Command failed with exit code 1.
make: *** [Makefile:45[3](https://github.com/coder/coder/actions/runs/3617487847/jobs/6096383996#step:14:3): docs/admin/prometheus.md] Error 1
make: *** Waiting for unfinished jobs....
Error: Process completed with exit code 2.

When make gen fails, target files are deleted. The filedocs/admin/prometheus.md is special, as the gen modifies it in-place. We don't want it to be deleted.

@mtojek mtojek self-assigned this Dec 5, 2022
@mtojek mtojek marked this pull request as ready for review December 5, 2022 10:03
@mtojek mtojek requested a review from a team December 5, 2022 10:03
Makefile Outdated
yarn run format:write
endif
.PRECIOUS: docs/admin/prometheus.md
Copy link
Member

Choose a reason for hiding this comment

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

We don't use this for other tasks so I don't think we should use it here otherwise devs may commit unformatted docs. I think removing the format:check should be good enough.

Can you change the format:write to only do it on the single file as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, when make receives a signal to quit/kill, it should delete all target files, so in this case PRECIOUS seems to be reasonable.

I can try without the marker and see if it's sufficient. I can iterate on it if it isn't.

@@ -29,45 +29,45 @@ The environment variable `CODER_PROMETHEUS_ENABLE` will be enabled automatically

<!-- Code generated by 'make docs/admin/prometheus.md'. DO NOT EDIT -->

| Name | Type | Description | Labels |
Copy link
Member Author

Choose a reason for hiding this comment

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

This is interesting. It seems that prettier is skipping docs.

@mtojek
Copy link
Member Author

mtojek commented Dec 5, 2022

Closing in favor of #5285

@mtojek mtojek closed this Dec 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants