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

Sketch new "Maintenance tasks and scripts" contributing dev docs #21061

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Jun 14, 2024

Fixes #21034

This adds a new page to the "contributing > development" section of the docs, that describes various common tasks that happen as part of the development flow. This is partly reminding us of various scripts in build-support/bin/, but not entirely.

This is just a starting point: it doesn't list all the scripts in build-support/bin/ (although some aren't intended for human use anyway, I believe), probably doesn't list all the tasks. Easy to expand in future!

Rendered table of contents:

image

@huonw huonw added category:documentation release-notes:not-required PR doesn't require mention in release notes labels Jun 14, 2024
@huonw huonw force-pushed the huonw/21034-common-tasks-contributing branch from 3e1eca5 to b754deb Compare June 14, 2024 11:58
@huonw huonw force-pushed the huonw/21034-common-tasks-contributing branch from b754deb to 64d1aa6 Compare June 14, 2024 12:01
1. Adjust `default_version` and/or `default_artifacts` as required.
2. Run `build-support/bin/generate_builtin_lockfiles.py $scope`, where `$scope` is the `options_scope` of the subsystem class.

Example: none yet.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find a single JVMToolBase that we've updated since it was first added, i.e. no pull request that does the update. I might've missed one though. Let me know if you know of one.

Comment on lines 65 to 71
## Generate a new JSON schema file: `generate_json_schema.py`

Some editors can use JSON Schema for better completions (etc.) when editing TOML files like `pants.toml`. To generate such a schema:

1. Run `./pants help-all > all-help.json`
2. Run `./pants run build-support/bin/generate_json_schema.py -- --all-help-file=all-help.json`
3. For a new release, upload the resulting file to https://www.schemastore.org/json/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure of the details here: maybe @AlexTereshenkov is the right person to provide insight? 😄

Comment on lines +77 to +82
### AWS Lambda

1. Adjust `PythonAwsLambdaRuntime.known_runtimes` as required
2. Run `build-support/bin/generate_faas_complete_platforms.py` to create any new files and update the existing ones, using AWS's published docker images

Example: [#21004](https://github.com/pantsbuild/pants/pull/21004).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the section that (hopefully!) satisfies the original request from #21004 (review)

@huonw huonw requested review from kaos and AlexTereshenkov June 14, 2024 12:03
@huonw huonw marked this pull request as ready for review June 14, 2024 12:03
Copy link
Member

@kaos kaos left a comment

Choose a reason for hiding this comment

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

Great! Thanks for putting this together @huonw 🚀

1. For each platform and version to add:
1. Download the archive/binary.
2. Verify it: check signatures and/or hashes if available.
3. Compute the sha256 hash and byte length. For example, if it's called `archive.zip`: `tee >(shasum -a 256) >(wc -c) > /dev/null < archive.zip`.
Copy link
Member

Choose a reason for hiding this comment

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

I really like the one line approach with curl, such as:

You can easily get the len and checksum with the following command:
curl -L $URL | tee >(wc -c) >(shasum -a 256) >/dev/null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that style, but I thought step 2 was fairly important: if Pants distributed an obviously-incorrect artifact by default (e.g. someone has uploaded a different binary that doesn't match signature), that would be very bad behaviour on our part!

It seems more acceptable/less egregious if a user does it to themselves, in their own local config.

Comment on lines 69 to 70
1. Run `./pants help-all > all-help.json`
2. Run `./pants run build-support/bin/generate_json_schema.py -- --all-help-file=all-help.json`
Copy link
Member

Choose a reason for hiding this comment

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

is the ./ prefix here intentional? The previous pants invocation was without.. I guess it'll be a matter of preference to whom ever runs the command, I just wonder if we should be consistent/prefer one over the other in the documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, just copied from the generate_json_schema.py script. Will adjust. Good catch.

@huonw
Copy link
Contributor Author

huonw commented Jun 17, 2024

Added a section about the auto-cherry-picking based on @lilatomic's idea in #21034 (comment)

@huonw huonw requested a review from lilatomic June 17, 2024 07:26
@huonw
Copy link
Contributor Author

huonw commented Jun 18, 2024

I'm gonna get this in as is, and others can iterate/collaborate easily too.

Of course, let me know if you have any feedback on this and I'll do a follow-up PR.

@huonw huonw merged commit 6f3a311 into main Jun 18, 2024
25 checks passed
@huonw huonw deleted the huonw/21034-common-tasks-contributing branch June 18, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:documentation release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Common tasks" contributing docs
2 participants