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

Chore: devcontainer cleanup #318

Merged
merged 2 commits into from
Sep 15, 2023
Merged

Chore: devcontainer cleanup #318

merged 2 commits into from
Sep 15, 2023

Conversation

thekaveman
Copy link
Member

  • Use black and flake8 VS Code extensions
  • Clean up Docker build

@thekaveman thekaveman requested a review from a team as a code owner September 14, 2023 23:01
@thekaveman thekaveman added the chore Chores and tasks for code cleanup, dev experience, etc. label Sep 14, 2023
@thekaveman thekaveman self-assigned this Sep 14, 2023
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

It took a long time for the pre-commit hooks to install for some reason, but I was able to rebuild and open the devcontainer with this setup 👍

@thekaveman
Copy link
Member Author

It took a long time for the pre-commit hooks to install for some reason

Was this during the build of the devcontainer image, or when it was starting up?

@angela-tran
Copy link
Member

angela-tran commented Sep 15, 2023

It took a long time for the pre-commit hooks to install for some reason

Was this during the build of the devcontainer image, or when it was starting up?

During the build of the devcontainer image. I just tried it again to confirm:
image

My build yesterday took even longer than 99 seconds to install pre-commit hooks. I think it was at least over 5 minutes.

@thekaveman
Copy link
Member Author

thekaveman commented Sep 15, 2023

Can you confirm if you're seeing the same slow builds across benefits, eligibility-api, hashfields, littlepay -- these all do the exact same thing in the devcontainer image build.

But only some of them use the pre-commit hook from https://github.com/igorshubovych/markdownlint-cli, and it seems like that may be slowing us down?

You can dump the full build log to a file to see exactly which one(s) are taking more time:

docker compose build --no-cache dev > build.log

I just did a run for eligibility-server and this is what the pre-commit step looks like:

#10 0.373 Initialized empty Git repository in /home/calitp/app/.git/
#10 1.035 [INFO] Initializing environment for https://github.com/compilerla/conventional-pre-commit.
#10 1.838 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
#10 2.700 [INFO] Initializing environment for https://github.com/psf/black.
#10 3.918 [INFO] Initializing environment for https://github.com/PyCQA/flake8.
#10 4.790 [INFO] Initializing environment for https://github.com/pycqa/bandit.
#10 5.819 [INFO] Initializing environment for https://github.com/igorshubovych/markdownlint-cli.
#10 8.207 [INFO] Installing environment for https://github.com/compilerla/conventional-pre-commit.
#10 8.208 [INFO] Once installed this environment will be reused.
#10 8.208 [INFO] This may take a few minutes...
#10 42.86 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
#10 42.86 [INFO] Once installed this environment will be reused.
#10 42.86 [INFO] This may take a few minutes...
#10 48.73 [INFO] Installing environment for https://github.com/psf/black.
#10 48.74 [INFO] Once installed this environment will be reused.
#10 48.74 [INFO] This may take a few minutes...
#10 61.36 [INFO] Installing environment for https://github.com/PyCQA/flake8.
#10 61.36 [INFO] Once installed this environment will be reused.
#10 61.36 [INFO] This may take a few minutes...
#10 70.55 [INFO] Installing environment for https://github.com/pycqa/bandit.
#10 70.55 [INFO] Once installed this environment will be reused.
#10 70.55 [INFO] This may take a few minutes...
#10 82.98 [INFO] Installing environment for https://github.com/igorshubovych/markdownlint-cli.
#10 82.98 [INFO] Once installed this environment will be reused.
#10 82.98 [INFO] This may take a few minutes...
#10 DONE 112.8s

I'm sad to see conventional-pre-commit taking 30+ seconds to install the environment 😕

markdownlint-cli is clocking about the same.

Here's a run for hashfields (no markdownlint-cli):

#12 1.607 Initialized empty Git repository in /home/calitp/hashfields/.git/
#12 2.642 [INFO] Initializing environment for https://github.com/compilerla/conventional-pre-commit.
#12 3.515 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
#12 4.866 [INFO] Initializing environment for https://github.com/psf/black.
#12 6.162 [INFO] Initializing environment for https://github.com/PyCQA/flake8.
#12 7.055 [INFO] Initializing environment for https://github.com/pycqa/bandit.
#12 8.388 [INFO] Installing environment for https://github.com/compilerla/conventional-pre-commit.
#12 8.389 [INFO] Once installed this environment will be reused.
#12 8.389 [INFO] This may take a few minutes...
#12 22.13 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
#12 22.13 [INFO] Once installed this environment will be reused.
#12 22.13 [INFO] This may take a few minutes...
#12 33.18 [INFO] Installing environment for https://github.com/psf/black.
#12 33.18 [INFO] Once installed this environment will be reused.
#12 33.18 [INFO] This may take a few minutes...
#12 58.42 [INFO] Installing environment for https://github.com/PyCQA/flake8.
#12 58.42 [INFO] Once installed this environment will be reused.
#12 58.42 [INFO] This may take a few minutes...
#12 64.95 [INFO] Installing environment for https://github.com/pycqa/bandit.
#12 64.96 [INFO] Once installed this environment will be reused.
#12 64.96 [INFO] This may take a few minutes...
#12 DONE 75.1s

conventional-pre-commit took about half the time as in the previous example, but I will note the version on hashfields is higher than the version on here (pending #319).

@thekaveman
Copy link
Member Author

I'm going to merge this since it's working, we'll continue to investigate the slow build times.

@thekaveman thekaveman merged commit f459b64 into dev Sep 15, 2023
6 checks passed
@thekaveman thekaveman deleted the chore/devcontainer branch September 15, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chores and tasks for code cleanup, dev experience, etc.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants