Skip to content

Commit 1b929a5

Browse files
committed
gitrepo: Intro contentConfigChecksum & improvement
Introduce contentConfigChecksum in the GitRepository.Status to track the configurations that affect the content of the artifact. It is used to detect a change in the configuration that requires rebuilding the whole artifact. This helps skip the reconciliation early when we find out that the remote repository has not changed. Moves fetching the included repositories in reconcileSource() to collect enough information in reconcileSource() to be able to decide if the full reconciliation can be skipped. This results in reconcileInclude() to just copy artifact to the source build directory. Introduce a gitCheckout() method to perform construction of all the git checkout options and perform the checkout operation. This helps to easily perform checkout multiple times when we need it in reconcileSource(). When we check with the remote repository if there's an update, and find out that there's no update, we check if any other configurations that affect the source content has changed, like includes, ignore rules, etc. If there's a change, we need to perform a full checkout of the remote repository in order to fetch the complete source. The git checkout no-op optimization is enabled in this method based on the presence of an artifact in the storage. The failure notification handler is modifed to handle the recovery of a no-op reconcile failure and create a notification message accordingly with the partial commit. Signed-off-by: Sunny <darkowlzz@protonmail.com>
1 parent c31500b commit 1b929a5

File tree

7 files changed

+575
-176
lines changed

7 files changed

+575
-176
lines changed

api/v1beta2/gitrepository_types.go

+11
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ type GitRepositoryStatus struct {
211211
// +optional
212212
IncludedArtifacts []*Artifact `json:"includedArtifacts,omitempty"`
213213

214+
// ContentConfigChecksum is a checksum of all the configurations related to
215+
// the content of the source artifact:
216+
// - .spec.ignore
217+
// - .spec.recurseSubmodules
218+
// - .spec.included and the checksum of the included artifacts
219+
// observed in .status.observedGeneration version of the object. This can
220+
// be used to determine if the content of the
221+
// It has the format of `<algo>:<checksum>`, for example: `sha256:<checksum>`.
222+
// +optional
223+
ContentConfigChecksum string `json:"contentConfigChecksum,omitempty"`
224+
214225
meta.ReconcileRequestStatus `json:",inline"`
215226
}
216227

config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,14 @@ spec:
653653
- type
654654
type: object
655655
type: array
656+
contentConfigChecksum:
657+
description: 'ContentConfigChecksum is a checksum of all the configurations
658+
related to the content of the source artifact: - .spec.ignore -
659+
.spec.recurseSubmodules - .spec.included and the checksum of the
660+
included artifacts observed in .status.observedGeneration version
661+
of the object. This can be used to determine if the content of the
662+
It has the format of `<algo>:<checksum>`, for example: `sha256:<checksum>`.'
663+
type: string
656664
includedArtifacts:
657665
description: IncludedArtifacts contains a list of the last successfully
658666
included Artifacts as instructed by GitRepositorySpec.Include.

0 commit comments

Comments
 (0)