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

Shallow Clone Cypress Repository in CI #28389

Closed
wants to merge 1 commit into from

Conversation

nalandial
Copy link
Contributor

@nalandial nalandial commented Nov 22, 2023

Additional details

Workspaces are unique per workflow per commit. In this example the workspace paths are different for the same job and branch:

https://app.circleci.com/pipelines/github/cypress-io/cypress/58352/workflows/0756ee6f-133f-4f70-86cd-8105c65844f6/jobs/2422136/parallel-runs/0/steps/0-101

https://app.circleci.com/pipelines/github/cypress-io/cypress/58333/workflows/bb132359-8160-48cd-88aa-ff1b6d9954fd/jobs/2421644/parallel-runs/0/steps/0-101

The total workspace size for those two commits is not 1.7GB, but 3.4GB.

This now does a shallow clone with --depth 1, which clones only the last commit and not the entire commit history. This reduces the size of the workspace by 630MB (see first layer). Since the clone is done at the beginning of the workflow and attached to the workspace for future jobs: though it has a negligible effect on overall pipeline execution time, it should be a noticible improvement in cost for workspace persistence.

Compare the size of the above workspaces to the one for this PR:

https://app.circleci.com/pipelines/github/cypress-io/cypress/58355/workflows/561d55a6-101d-470c-9b83-b137672dbc3b/jobs/2422279/parallel-runs/0/steps/0-101

How has the user experience changed?

See difference in size and download time in the above links.

@nalandial nalandial changed the title Shallow Clone Repository for CI Shallow Clone Cypress Repository in CI Nov 22, 2023
@jennifer-shehane jennifer-shehane removed their request for review November 22, 2023 23:45
@@ -1343,7 +1352,7 @@ jobs:
resource_class: << parameters.resource_class >>
steps:
- update_known_hosts
- checkout
- shallow_checkout
Copy link
Member

Choose a reason for hiding this comment

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

@nalandial I recently made this change and we had to back it out for two reasons 😢

  1. contributor PRs - example failure -- forked PRs have the CIRCLE_BRANCH set to pull/NUM which isn't a valid branch to checkout. I wrote this up, but wasn't able to verify;
  2. the release-readiness jobs expects the git history to validate the changelog - example failure. This would need a little tweaking to pull down the history on that job specifically.

Also, did you verify this works on Windows? I wasn't able to get the shallow checkout to work on Windows.

@jennifer-shehane
Copy link
Member

@nalandial Any update on this or Emily's comments?

@astone123
Copy link
Contributor

Closing due to inactivity

@astone123 astone123 closed this Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants