Skip to content

Commit 64d1aa6

Browse files
committed
Sketch "Maintenance tasks and scripts" contributing dev docs
1 parent e44697e commit 64d1aa6

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: Maintenance tasks and scripts
3+
sidebar_position: 6
4+
---
5+
6+
There's a variety of maintenance tasks that happen on different frequencies.
7+
8+
## Update the default/known versions of a built-in tool/subsystem
9+
10+
### External tools (downloaded executables)
11+
12+
Some tools use [the `ExternalTool` class](../../writing-plugins/the-rules-api/installing-tools#externaltool-install-pre-compiled-binaries) to download a binary from the internet, verify its size and hash, and then execute it.
13+
14+
To update these:
15+
16+
1. For each platform and version to add:
17+
1. Download the archive/binary.
18+
2. Verify it: check signatures and/or hashes if available.
19+
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`.
20+
2. Apply the new values:
21+
1. Adjust `default_version` to the new version.
22+
2. Add or replace to `default_known_versions` using the hashes and lengths above (for some tools we don't preserve older versions, especially if they have strong backwards compatibility guarantees, while for others we do retain older versions).
23+
24+
Example: [#20469](https://github.com/pantsbuild/pants/pull/20469).
25+
26+
#### PEX
27+
28+
The PEX external tool is a bit special, because it also appears as a requirement of the Pants project itself in `3rdparty/python/requirements.txt`. To update pex, do both:
29+
30+
1. Update the `pex-cli` subsystem, as above (in `src/python/pants/backend/python/util_rules/pex_cli.py`).
31+
2. Update the requirements file and run `pants generate-lockfiles --resolve=python-default` to update Pants' own lockfile.
32+
33+
Example: [#20782](https://github.com/pantsbuild/pants/pull/20782).
34+
35+
#### Terraform
36+
37+
The `build-support/bin/terraform_tool_versions.py` script can help update Terraform versions.
38+
39+
### Python tools
40+
41+
Some tools use `PythonToolBase` to install executable PyPI packages, using a lockfile. Pants packages a default lockfile with a specific version of the package. To update these:
42+
43+
1. Adjust `default_requirements` and/or `default_interpreter_constraints` as required.
44+
2. Run `build-support/bin/generate_builtin_lockfiles.py $scope`, where `$scope` is the `options_scope` of the subsystem class.
45+
46+
Example: [#20924](https://github.com/pantsbuild/pants/pull/20924).
47+
48+
### JVM tools
49+
50+
Some tools use `JVMToolBase` to install executable JVM packages, using a lockfile. Pants packages a default lockfile with a specific version of the package. To update these:
51+
52+
1. Adjust `default_version` and/or `default_artifacts` as required.
53+
2. Run `build-support/bin/generate_builtin_lockfiles.py $scope`, where `$scope` is the `options_scope` of the subsystem class.
54+
55+
Example: none yet.
56+
57+
### JS tools
58+
59+
Some tools use `NodeJSToolBase` to install executable npm packages. To update these:
60+
61+
1. Update `default_version`. That's all.
62+
63+
Example: [#21007](https://github.com/pantsbuild/pants/pull/21007).
64+
65+
## Generate a new JSON schema file
66+
67+
Some editors can use JSON Schema for better completions (etc.) when editing TOML files like `pants.toml`. To generate such a schema:
68+
69+
1. Run `./pants help-all > all-help.json`
70+
2. Run `./pants run build-support/bin/generate_json_schema.py -- --all-help-file=all-help.json`
71+
3. For a new release, upload the resulting file to https://www.schemastore.org/json/
72+
73+
## Update or create FaaS complete platforms files
74+
75+
The function-as-a-service (FaaS) subsystems provide some built-in PEX complete platforms JSON files, for specific runtimes. To update or create these:
76+
77+
### AWS Lambda
78+
79+
1. Adjust `PythonAwsLambdaRuntime.known_runtimes` as required
80+
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
81+
82+
Example: [#21004](https://github.com/pantsbuild/pants/pull/21004).
83+
84+
### Google Cloud Functions
85+
86+
Complete platforms are not provided for GCF yet: [#18195](https://github.com/pantsbuild/pants/issues/18195).

0 commit comments

Comments
 (0)