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

[feature request]: docker support #11

Open
henryiii opened this issue Oct 28, 2020 · 9 comments
Open

[feature request]: docker support #11

henryiii opened this issue Oct 28, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@henryiii
Copy link

I tried out the pre-commit ci on CLI11 and immediately ran into the fact that docker is not available. Would it be possible to eventually support the docker pre-commit actions? I use clang-format quite often.

@asottile asottile added the enhancement New feature or request label Oct 28, 2020
@asottile
Copy link
Member

I'm not sure how docker support fits into the puzzle unfortunately. it will probably have to be a pro feature, if at all due to needing network at runtime (a risk I'm not currently willing to take)

@asottile
Copy link
Member

I could maybe do some podman-in-podman shenanigans 🤔

@mathbunnyru
Copy link

It would be nice to have a support for docker in pre-commit.ci, some checks are based on docker.

Maybe, more general feature would be to support building in the custom docker image, though.

@asottile
Copy link
Member

asottile commented May 31, 2021

@mathbunnyru that's already implement, though disabled at the moment. it's unfortunately costly to enable the feature and introduces a lot of unpredictability in the runtime -- it will likely be locked behind hosted / pro-tier due to those reasons

that said, there will be add-ons at some point which will make "customizing" the image easier (for example, a "terraform" add-on might put a system terraform binary on the PATH) (#13)

@mathbunnyru
Copy link

@mathbunnyru that's already implement, though disabled at the moment. it's unfortunately costly to enable the feature and introduces a lot of unpredictability in the runtime -- it will likely be locked behind hosted / pro-tier due to those reasons

that said, there will be add-ons at some point which will make "customizing" the image easier (for example, a "terraform" add-on might put a system terraform binary on the PATH) (#13)

Thanks, @asottile.

@Kurt-von-Laven
Copy link

I'm not sure how docker support fits into the puzzle unfortunately. it will probably have to be a pro feature, if at all due to needing network at runtime (a risk I'm not currently willing to take)

@asottile, would only supporting rootless Docker with networking disabled be a viable option? Personally, I'm not a huge fan of pre-commit hooks that require runtime network access (beyond setting up the environment of course) in the first place since they can make working offline a hassle.

@henryiii
Copy link
Author

henryiii commented Oct 1, 2021

For completeness, a few days ago clang-format was released as wheels for all platforms, and that solved my issues; it's now easy to run clang-format instantly anywhere and it's a 1 MB to max 2MB download. That runs conda-forge (~200MB after days of fighting with it, down from 650 MB) in the the ground, and Docker obviously is behind even that. And you can pin 10, 11, or 12.

repos:
- repo: https://github.com/ssciwr/clang-format-hook
  rev: v12.0.1
  hooks:
  - id: clang-format

This is only a solution for this one specific case, but it's a good one! I've moved all five of my previously docker-using repos to pre-commit.ci now. Pretty sure I wasn't using docker anywhere else for anything else in pre-commit.

@asottile
Copy link
Member

asottile commented Oct 1, 2021

if this gets implemented it'll be rootless networkless podman -- but it's fairly far off, complicated, and low on the priority list at the moment

@asottile
Copy link
Member

I've just released a brand new "lite" version of pre-commit.ci which may be of interest until the full version has language: docker support. you can read more about it at https://pre-commit.ci/lite -- the tl;dr is adds autofixing to GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants