source-controller icon indicating copy to clipboard operation
source-controller copied to clipboard

Update artifact tarball when `spec.ignore` changes

Open angelokurtis opened this issue 3 years ago • 8 comments

This commit adds a new field status.artifact.excludedPatternsChecksum which is used to detect changes on spec.ignore, that controls the exclusions for the object's status.artifact.

Fix: https://github.com/fluxcd/source-controller/issues/704

angelokurtis avatar May 06 '22 17:05 angelokurtis

Hi, thanks for proposing this solution. Sharing a few thoughts about it:

  • Maybe it'd be better to not mix the terms. The spec has it as ignore, it'd be better to call the new field with the same name.
  • Ignore is an attribute of GitRepo and Bucket only. Adding the checksum field as part of artifact exposes it to all the other source types. Maybe it'd be better to introduce it in the status of GitRepo and Bucket only. There's already status.includedArtifacts in GitRepo. Maybe we could have ignored informtion there as well.

darkowlzz avatar May 09 '22 10:05 darkowlzz

@darkowlzz you are pretty much reflecting my thoughts in https://github.com/fluxcd/source-controller/pull/710 :-)

hiddeco avatar May 09 '22 10:05 hiddeco

Hey everyone! Thanks for the feedback! I updated the PR with your suggestions. Please let me know if you see any other improvements.

angelokurtis avatar May 09 '22 19:05 angelokurtis

Please rebase with upstream main, we've fixed the e2e tests.

stefanprodan avatar May 10 '22 13:05 stefanprodan

Could you also update the spec docs in https://github.com/fluxcd/source-controller/tree/main/docs/spec/v1beta2 for both GitRepo and Bucket in the Status section towards the bottom of the docs with some documentation for the checksum field?

darkowlzz avatar May 11 '22 08:05 darkowlzz

Hi guys, thanks for the support! Please, let me know if you see any other improvements.

angelokurtis avatar May 13 '22 19:05 angelokurtis

Hi, due to some recent changes in the main branch, we had to restructure a lot of the code in GitRepo reconciler. A rough work on fixing that is in https://github.com/fluxcd/source-controller/compare/gitrepo-rec-fixes . It changes how we figure out if the source needs to be reconciled completely or not, similar to detecting changes to spec.ignore in this PR. The new work introduces a contentConfigChecksum field in the API, which includes the ignore value and many other fields that contribute to a new artifact to be built https://github.com/fluxcd/source-controller/compare/gitrepo-rec-fixes?expand=1#diff-4472354d9c6813ee6537b2625d7aa7eef2522f48bc45548c1397f207ff85cbc9R214-R223 . I'd recommend to wait for that change to be finalized and merged first, and then based on those changes, add a similar change for the Bucket reconciler for detecting ignore + all other config changes. Sorry for this. It wasn't planned before but the solution to fixing other stuff covers the issue that this PR tries to fix.

darkowlzz avatar May 18 '22 07:05 darkowlzz

@angelokurtis flux v0.31.0 was just released with the aforementioned improvements in the GitRepo reconciler. Your initial issue https://github.com/fluxcd/source-controller/issues/704 is closed. But you can still add a similar change in the Bucket reconciler based on the GitRepo reconcile change in https://github.com/fluxcd/source-controller/commit/581695b4d621fccb9b6a264b5dbcedf97151cec0. We can introduce the same field contentConfigChecksum in the status of a Bucket object and use it to detect changes. This may also result in restructuring some parts of the Bucket reconciler, but I think that's okay. Feel free to ask any questions about it that you may have.

darkowlzz avatar Jun 06 '22 16:06 darkowlzz

Superseded by #926

stefanprodan avatar Oct 11 '22 09:10 stefanprodan