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

Add option to specify clone options #757

Closed
benoitf opened this issue Jan 26, 2022 · 4 comments
Closed

Add option to specify clone options #757

benoitf opened this issue Jan 26, 2022 · 4 comments
Milestone

Comments

@benoitf
Copy link
Collaborator

benoitf commented Jan 26, 2022

Description

Today, starting a workspace with for example https://github.com/che-incubator/che-code is taking a long time

But if I'm interested only in the current main branch, then I could have a way to specify the depth (history of commits) I want

For example, in github actions https://github.com/actions/checkout I have

    # Number of commits to fetch. 0 indicates all history for all branches and tags.
    # Default: 1
    fetch-depth: ''

so I would like to be able to specify the depth

Additional context

@benoitf
Copy link
Collaborator Author

benoitf commented Jan 27, 2022

One option could be to fetch only one commit of history at clone time and fetch all the history once the workspace has been started (lazy mode to fetch full history)

@amisevsk
Copy link
Collaborator

amisevsk commented Feb 1, 2022

This seems like something that would be useful to have somewhere in the devfile/api spec itself rather than as a DWO-only feature.

@nickboldt
Copy link
Collaborator

nickboldt commented Mar 7, 2022

I could also see value in being able to specify a sparseCheckoutDir or workingDir or regexPathExcludes or regexPathIncludes so that the resulting cloned project can exclude paths not needed in the clone.

For example, https://github.com/crw-samples/jboss-eap-quickstarts/blob/devfilev2/devfile.yaml will clone the whole project but only one folder, https://github.com/crw-samples/jboss-eap-quickstarts/tree/devfilev2/kitchensink-jsp is referred by the devfile.

Similarly https://github.com/crw-samples/quarkus-quickstarts/tree/devfilev2 has a devfile which uses only the https://github.com/crw-samples/quarkus-quickstarts/tree/devfilev2/getting-started folder, which would exclude all the other projects and save space/time when creating a workspace (or caching content for offline/airgap scenarios)

@amisevsk
Copy link
Collaborator

To update this issue for (now) 2024: DWO has the following features built in:

  • Sparse checkouts are supported by the operator via the sparseCheckout attribute on projects [doc]
  • In addition, for starter projects we support the subDir field, which first clones a whole project and then saves only a subdirectory of that project (which would be useful for the sample mentioned by Nick above

Both of the above features were added in #1130 and are a part of DWO v0.22 and onward.

I'm closing this issue as I don't believe we have any intention of implementing shallow clones in DWO; in general, while shallow cloning is useful in CI builds, it's not recommended for most development flows and would likely cause more issues than it resolves.

If we want to consider enabling partial clones (e.g. a blobless clone), we should open a separate issue.

@AObuchow AObuchow added this to the v0.22.x milestone Feb 7, 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

No branches or pull requests

4 participants