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

Adds a caching example for CircleCI #364

Merged
merged 1 commit into from Jul 13, 2020

Conversation

@remeika
Copy link
Contributor

@remeika remeika commented Jun 26, 2020

Updates docs about managing CI caches to include general guidance on how to version the cache, and a specific example of how to do this in CircleCI.

@remeika remeika force-pushed the remeika:cache-versioning-circle-ci branch from 96c9b6c to 7e164d2 Jun 26, 2020
index.mako Outdated
steps:
- run:
command: |
cat .pre-commit-config.yaml > pre-commit-deps.txt

This comment has been minimized.

@asottile

asottile Jun 26, 2020
Member

UUOC: cp does this better

but why make a separate file, can't you just use the original file?

also looks like pre-commit-deps.txt is unused

This comment has been minimized.

@remeika

remeika Jun 26, 2020
Author Contributor

This was a copy-pasta error. Creating a new file, pre-commit-cache-key.txt, to concatenate .pre-commit-config.yaml & python -VV, since CircleCI can't use environment variables in cache key templates.

index.mako Outdated
@@ -1572,6 +1572,10 @@ which may be faster, use something like
[XDG Base Directory Specification]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
If your CI environment uses immutable caches, the pre-commit repository should
be versioned using both the contents of your configuration file (typically
`.pre-commit-config.yaml`) and the output of the command `python -VV`.

This comment has been minimized.

@asottile

asottile Jun 26, 2020
Member

this isn't always completely true, but is a good estimate for the healthy() check

This comment has been minimized.

@remeika

remeika Jun 26, 2020
Author Contributor

Good info. Added a note below with that caveat.

index.mako Outdated
```yaml
steps:
- run:
command: |

This comment has been minimized.

@asottile

asottile Jun 26, 2020
Member

this indentation doesn't line up properly (either use 2 or 4 space indents, but not mixed)

This comment has been minimized.

@remeika

remeika Jun 26, 2020
Author Contributor

Fixed.

@asottile asottile force-pushed the remeika:cache-versioning-circle-ci branch from c6e4b73 to 9424660 Jul 13, 2020
Copy link
Member

@asottile asottile left a comment

I ended up just removing the immutable part that was added -- I didn't like the wording "gory details" and the advice was too python-specific (and there are cases where even that is insufficient). I also added the (missing) restore_cache step which I believe is necessary for circle to work

thanks again for the patch!

@asottile asottile merged commit 80348fd into pre-commit:master Jul 13, 2020
2 checks passed
2 checks passed
pr
Details
pre-commit.pre-commit.com #20200713.1 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.