jenkins-x-plugins / jx-gitops

a simple CLI tool for working with kubernetes resources files in a GitOps repository
Apache License 2.0
33 stars 51 forks source link

feat: attempt partial clone of cluster repo when loading requirements #973

Closed GavinPJK closed 1 week ago

GavinPJK commented 1 month ago

Use PartialCloneClusterRepo (from following addition to jx-helpers - https://github.com/jenkins-x/jx-helpers/pull/420) to attempt sparse and partial clone of the upstream cluster repository, as only the .jx/gitops/source-config.yaml file is required when finding requirements with variablefinders.

This change impacts the speed of jx gitops helm release and jx gitops variables commands when the upstream git provider supports git-sparse-checkout, in addition to the --filter=blob:none and --depth=1 flags. Falls back to a full clone if neither are supported.

Picking a real example that is used for the following jx-variables pipeline task step - https://github.com/jenkins-x/jx3-pipeline-catalog/blob/b14ab0afd073539a25e5f2cee342f1e99537b46a/tasks/csharp/pullrequest.yaml#L27-L36:

Before (step duration = 1m 16s):

Screenshot_20241016_123448-1

After (step duration = 8s):

sparse-clone

GavinPJK commented 1 month ago

/cc @msvticket

jenkins-x-bot commented 1 month ago

Hi @GavinPJK. Thanks for your PR.

I'm waiting for a jenkins-x-plugins member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository.
msvticket commented 3 weeks ago

/ok-to-test

GavinPJK commented 1 week ago

/retest

msvticket commented 1 week ago

/retest

msvticket commented 1 week ago

@GavinPJK It's the same here: rebase on main. In this case so the lint pipeline will run.

msvticket commented 1 week ago

@GavinPJK You should also verify that make test succeeds after the rebase

sonarcloud[bot] commented 1 week ago

Quality Gate Failed Quality Gate failed

Failed conditions
85.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

msvticket commented 1 week ago

/approve

jenkins-x-bot commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: msvticket

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/jenkins-x-plugins/jx-gitops/blob/main/OWNERS)~~ [msvticket] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
jenkins-x-bot commented 1 week ago

Failed to merge this PR due to:

failed merging [973]: [Method Not Allowed]